Skip to content

Commit 0499579

Browse files
committed
refresh interval for each panel, fix #116, fix #95
1 parent ea1c2b4 commit 0499579

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

display.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,10 @@ function display_information() {
307307
}
308308
else { // intropage in console or in tab
309309
if ($lopts == 4) { // in tab
310-
print "<option value='loginopt_console'>" . __('Display intropage in console', 'intropage') . '</option>';
310+
print "<option value='loginopt_console'>" . __('Display intropage in console (needs relogin)', 'intropage') . '</option>';
311311
}
312312
else {
313-
print "<option value='loginopt_tab'>" . __('Display intropage in tab as default page', 'intropage') . '</option>';
313+
print "<option value='loginopt_tab'>" . __('Display intropage in tab as default page (needs relogin)', 'intropage') . '</option>';
314314
}
315315
}
316316

include/actions.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333

3434
if (isset_request_var('intropage_settings')) {
3535

36+
if (get_request_var('intropage_cancel')) {
37+
return;
38+
}
39+
3640
// dashboard names
3741
$number_of_dashboards = read_user_setting('intropage_number_of_dashboards',1);
3842

@@ -50,7 +54,8 @@
5054
// panel refresh
5155
$panels = db_fetch_assoc_prepared('SELECT t1.panel_id AS panel_name,t1.id AS id FROM plugin_intropage_panel_data AS t1
5256
JOIN plugin_intropage_panel_dashboard AS t2
53-
ON t1.id=t2.panel_id WHERE t2.user_id= ?',
57+
ON t1.id=t2.panel_id WHERE t2.user_id= ?
58+
AND t1.fav_graph_id IS NULL',
5459
array($_SESSION['sess_user_id']));
5560

5661
if (cacti_sizeof($panels)) {

include/data.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,8 @@ function top5_ping($display=false, $update=false, $force_update=false) {
327327
array($user['id'],$panel_id));
328328

329329
$update_interval = db_fetch_cell_prepared('SELECT refresh_interval FROM plugin_intropage_panel_data
330-
WHERE panel_id= ? AND user_id= 0',
331-
array($panel_id));
330+
WHERE panel_id= ? AND user_id= ?',
331+
array($panel_id, $user['id']));
332332

333333

334334
if ( $force_update || time() > ($last_update + $update_interval)) {
@@ -513,7 +513,7 @@ function cpuload($display=false, $update=false, $force_update=false) {
513513

514514
if ($display) {
515515
$result = db_fetch_row_prepared("SELECT id, data, alarm, last_update,
516-
concatfloor(TIME_FORMAT(SEC_TO_TIME(refresh_interval), '%H') / 24), 'd ',
516+
concat(floor(TIME_FORMAT(SEC_TO_TIME(refresh_interval), '%H') / 24), 'd ',
517517
MOD(TIME_FORMAT(SEC_TO_TIME(refresh_interval), '%H'), 24), 'h:',
518518
TIME_FORMAT(SEC_TO_TIME(refresh_interval), '%im')) AS recheck
519519
FROM plugin_intropage_panel_data
@@ -2779,7 +2779,7 @@ function boost($display=false, $update=false, $force_update=false) {
27792779
$next_run_time = read_config_option('boost_next_run_time', true);
27802780
$max_records = read_config_option('boost_rrd_update_max_records', true);
27812781
$max_runtime = read_config_option('boost_rrd_update_max_runtime', true);
2782-
$update_interval = read_config_option('boost_rrd_update_interval', true);
2782+
$update_int = read_config_option('boost_rrd_update_interval', true);
27832783
$peak_memory = read_config_option('boost_peak_memory', true);
27842784
$detail_stats = read_config_option('stats_detail_boost', true);
27852785

@@ -2885,7 +2885,7 @@ function boost($display=false, $update=false, $force_update=false) {
28852885
$result['data'] .= __('Last run duration: %s', $lastduration, 'intropage') . '<br/>';
28862886

28872887
$result['data'] .= __('RRD Updates / Max: %s / %s', $boost_rrds_updated != '' ? number_format_i18n($boost_rrds_updated, -1) : '-', number_format_i18n($max_records, -1), 'intropage') . '<br/>';
2888-
$result['data'] .= __('Update Frequency: %s', $rrd_updates == '' ? __('N/A') : $boost_refresh_interval[$update_interval], 'intropage') . '<br/>';
2888+
$result['data'] .= __('Update Frequency: %s', $rrd_updates == '' ? __('N/A') : $boost_refresh_interval[$update_int], 'intropage') . '<br/>';
28892889
$result['data'] .= __('Next Start Time: %s', $next_run_time, 'intropage') . '<br/>';
28902890

28912891
db_execute_prepared('REPLACE INTO plugin_intropage_panel_data

include/functions.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,6 @@ function intropage_display_data($panel_id,$dispdata) {
315315

316316
print '<br/>' . __('Last update','intropage') . ': ' . $dispdata['last_update'] . '/' .
317317
__('Recheck every','intropage') .': ' . $dispdata['recheck'];
318-
// print '<br/>' . __('Last update','intropage') . ': ' . $dispdata['last_update'];
319-
// print '<br/>' . __('Recheck every','intropage') .': ' . $dispdata['recheck'];
320318
}
321319
}
322320
}
@@ -420,6 +418,7 @@ function display_setting () {
420418
JOIN plugin_intropage_panel_dashboard AS t2
421419
ON t1.id=t2.panel_id
422420
WHERE t2.user_id= ?
421+
AND t1.fav_graph_id IS NULL
423422
ORDER BY t2.dashboard_id',
424423
array($_SESSION['sess_user_id']));
425424

@@ -434,6 +433,10 @@ function display_setting () {
434433
print ucwords(str_replace('_', ' ', $panel['panel_id'])) . " : ";
435434
print '</td><td>';
436435
print '<input type="text" name="crefresh_' . $panel['id'] . '" value="' . $panel['refresh_interval'] . '"> ';
436+
if ($panel['panel_id'] == 'analyse_db') {
437+
print __('Only admin can set this in Console -> Configuration -> Settings');
438+
439+
}
437440
if ($panel['user_id'] == 0) {
438441

439442
print __('Common panel - refresh interval is the same for all users!');
@@ -446,7 +449,9 @@ function display_setting () {
446449

447450
print '<br/><br/>';
448451
print '<input type="hidden" name="intropage_settings" value="true">';
452+
print '<input type="submit" name="cancel" value="' . __('Cancel', 'intropage') . '"> ';
449453
print '<input type="submit" value="' . __('Save', 'intropage') . '">';
454+
450455
print '</div>';
451456

452457
}

0 commit comments

Comments
 (0)