Merge branch '1459-Campo-para-establecer-el-tiempo-de-autorefresco-dev' into 'develop'

Added time autorefresh

See merge request artica/pandorafms!945
This commit is contained in:
nramon 2017-10-30 10:58:07 +01:00
commit 49a1f7d872
5 changed files with 22 additions and 4 deletions

View File

@ -0,0 +1,3 @@
START TRANSACTION;
ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30';
COMMIT;

View File

@ -1183,6 +1183,7 @@ ALTER TABLE tusuario ADD COLUMN `id_filter` int(10) UNSIGNED NULL DEFAULT NULL;
ALTER TABLE tusuario ADD CONSTRAINT `fk_id_filter` FOREIGN KEY (`id_filter`) REFERENCES tevent_filter(`id_filter`) ON DELETE SET NULL;
ALTER TABLE tusuario ADD COLUMN `session_time` int(10) signed NOT NULL default '0';
alter table tusuario add autorefresh_white_list text not null default '';
ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30';
-- ---------------------------------------------------------------------
-- Table `tagente_modulo`

View File

@ -191,7 +191,7 @@ config_check();
$_GET['refr'] = null;
}
$select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '" . $config['id_user'] . "'");
$select = db_process_sql("SELECT autorefresh_white_list,time_autorefresh FROM tusuario WHERE id_user = '" . $config['id_user'] . "'");
$autorefresh_list = json_decode($select[0]['autorefresh_white_list']);
if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) {
@ -389,7 +389,15 @@ config_check();
$("#combo_refr").toggle ();
$("#combo_refr").css('padding-right', '9px');
href = $("a.autorefresh").attr ("href");
$(document).attr ("location", href + "30");
<?php
if($select[0]['time_autorefresh']){
?>
var refresh = '<?php echo $select[0]["time_autorefresh"] ?>';
$(document).attr ("location", href + refresh);
<?php
}
?>
<?php
}
}

View File

@ -100,6 +100,8 @@ if (isset ($_GET["modified"]) && !$view_mode) {
$upd_info['autorefresh_white_list'] = json_encode($autorefresh_list);
}
$upd_info['time_autorefresh'] = (int) get_parameter ("time_autorefresh", 0);
$is_admin = db_get_value('is_admin', 'tusuario', 'id_user', $id);
$section = io_safe_output($upd_info["section"]);
@ -439,10 +441,13 @@ $table_ichanges = '<table style="position:relative;left:160px;">
</table>';
$data[0] .= $table_ichanges;
//time autorefresh
$times = get_refresh_time_array();
$data[1] = '<span style="width:40%;float:left;">'.__('Time autorefresh').'</span>';
$data[1] .= $jump . '<span style="width:20%;float:left;">'. html_print_select ($times, 'time_autorefresh', $user_info["time_autorefresh"], '', '', '', true,false,false).'</span>';
$table->rowclass[] = '';
$table->colspan[count($table->data)][0] = 3;
$table->rowstyle[] = 'font-weight: bold;';
$table->rowstyle[] = 'font-weight: bold;vertical-align: top';
$table->data[] = $data;
$data = array();

View File

@ -1114,6 +1114,7 @@ CREATE TABLE IF NOT EXISTS `tusuario` (
`session_time` int(10) signed NOT NULL default 0,
`default_event_filter` int(10) unsigned NOT NULL default 0,
`autorefresh_white_list` text not null default '',
`time_autorefresh` int(5) unsigned NOT NULL default '30',
CONSTRAINT `fk_filter_id` FOREIGN KEY (`id_filter`) REFERENCES tevent_filter (`id_filter`) ON DELETE SET NULL,
UNIQUE KEY `id_user` (`id_user`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;