system support for personal configurable ajax update interval
This commit is contained in:
parent
834639ebab
commit
4f254ffb5b
4 changed files with 19 additions and 8 deletions
7
boot.php
7
boot.php
|
@ -422,6 +422,10 @@ class App {
|
||||||
}
|
}
|
||||||
|
|
||||||
function init_pagehead() {
|
function init_pagehead() {
|
||||||
|
$interval = ((local_user()) ? get_pconfig(local_user(),'system','update_interval') : 30000);
|
||||||
|
if($interval < 10000)
|
||||||
|
$interval = 30000;
|
||||||
|
|
||||||
$this->page['title'] = $this->config['sitename'];
|
$this->page['title'] = $this->config['sitename'];
|
||||||
$tpl = file_get_contents('view/head.tpl');
|
$tpl = file_get_contents('view/head.tpl');
|
||||||
$this->page['htmlhead'] = replace_macros($tpl,array(
|
$this->page['htmlhead'] = replace_macros($tpl,array(
|
||||||
|
@ -430,7 +434,8 @@ class App {
|
||||||
'$delitem' => t('Delete this item?'),
|
'$delitem' => t('Delete this item?'),
|
||||||
'$comment' => t('Comment'),
|
'$comment' => t('Comment'),
|
||||||
'$showmore' => t('show more'),
|
'$showmore' => t('show more'),
|
||||||
'$showfewer' => t('show fewer')
|
'$showfewer' => t('show fewer'),
|
||||||
|
'$update_interval' => $interval
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
index.php
16
index.php
|
@ -93,12 +93,6 @@ if((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) {
|
||||||
load_translation_table($lang);
|
load_translation_table($lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Create the page head after setting the language
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
$a->init_pagehead();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -119,6 +113,16 @@ if((x($_SESSION,'authenticated')) || (x($_POST,'auth-params')) || ($a->module ==
|
||||||
if(! x($_SESSION,'authenticated'))
|
if(! x($_SESSION,'authenticated'))
|
||||||
header('X-Account-Management-Status: none');
|
header('X-Account-Management-Status: none');
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create the page head after setting the language
|
||||||
|
* and getting any auth credentials
|
||||||
|
*/
|
||||||
|
|
||||||
|
$a->init_pagehead();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(! x($_SESSION,'sysmsg'))
|
if(! x($_SESSION,'sysmsg'))
|
||||||
$_SESSION['sysmsg'] = array();
|
$_SESSION['sysmsg'] = array();
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,7 @@
|
||||||
});
|
});
|
||||||
}) ;
|
}) ;
|
||||||
}
|
}
|
||||||
timer = setTimeout(NavUpdate,30000);
|
timer = setTimeout(NavUpdate,updateInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
function liveUpdate() {
|
function liveUpdate() {
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
<script type="text/javascript" src="$baseurl/js/main.js" ></script>
|
<script type="text/javascript" src="$baseurl/js/main.js" ></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
var updateInterval = $update_interval;
|
||||||
|
|
||||||
function confirmDelete() { return confirm("$delitem"); }
|
function confirmDelete() { return confirm("$delitem"); }
|
||||||
function commentOpen(obj,id) {
|
function commentOpen(obj,id) {
|
||||||
if(obj.value == '$comment') {
|
if(obj.value == '$comment') {
|
||||||
|
|
Loading…
Reference in a new issue