Added free search values to data table
This commit is contained in:
parent
9ecc68bfe7
commit
2adf951121
|
@ -123,12 +123,16 @@ if ($get_module_detail) {
|
||||||
$time_from = (string) get_parameter ('time_from', date ('h:iA'));
|
$time_from = (string) get_parameter ('time_from', date ('h:iA'));
|
||||||
$date_to = (string) get_parameter ('date_to', date ('Y-m-j'));
|
$date_to = (string) get_parameter ('date_to', date ('Y-m-j'));
|
||||||
$time_to = (string) get_parameter ('time_to', date ('h:iA'));
|
$time_to = (string) get_parameter ('time_to', date ('h:iA'));
|
||||||
|
$freesearch = (string) get_parameter ('freesearch', '');
|
||||||
|
|
||||||
$formtable->width = '98%';
|
$formtable->width = '98%';
|
||||||
$formtable->class = "databox";
|
$formtable->class = "databox";
|
||||||
$formtable->data = array ();
|
$formtable->data = array ();
|
||||||
$formtable->size = array ();
|
$formtable->size = array ();
|
||||||
|
|
||||||
|
$moduletype_name = modules_get_moduletype_name(
|
||||||
|
modules_get_agentmodule_type($module_id));
|
||||||
|
|
||||||
$periods = array(SECONDS_5MINUTES =>__('5 minutes'),
|
$periods = array(SECONDS_5MINUTES =>__('5 minutes'),
|
||||||
SECONDS_30MINUTES =>__('30 minutes'),
|
SECONDS_30MINUTES =>__('30 minutes'),
|
||||||
SECONDS_1HOUR =>__('1 hour'),
|
SECONDS_1HOUR =>__('1 hour'),
|
||||||
|
@ -148,13 +152,18 @@ if ($get_module_detail) {
|
||||||
"selection_mode", 'fromnow', '', $selection_mode, false, '',
|
"selection_mode", 'fromnow', '', $selection_mode, false, '',
|
||||||
'style="margin-right: 15px;"', true) . __("Choose a time from now");
|
'style="margin-right: 15px;"', true) . __("Choose a time from now");
|
||||||
$formtable->data[0][1] = html_print_select ($periods, 'period', $period, '', '', 0, true, false, false);
|
$formtable->data[0][1] = html_print_select ($periods, 'period', $period, '', '', 0, true, false, false);
|
||||||
$formtable->data[0][2] = '';
|
if (preg_match("/_string/", $moduletype_name)) {
|
||||||
|
$formtable->data[0][2] = __('Free search') . ' ';
|
||||||
|
$formtable->data[0][2] .= html_print_input_text ('freesearch', $freesearch, '', 25, null, true);
|
||||||
|
} else {
|
||||||
|
$freesearch = '';
|
||||||
|
$formtable->data[0][2] = '';
|
||||||
|
}
|
||||||
|
$formtable->cellstyle[0][3] = 'vertical-align: middle;';
|
||||||
$formtable->data[0][3] = "<a href='javascript: show_module_detail_dialog(" . $module_id .", ". $agentId.", \"" . $server_name .
|
$formtable->data[0][3] = "<a href='javascript: show_module_detail_dialog(" . $module_id .", ". $agentId.", \"" . $server_name .
|
||||||
"\", 0, -1,\"" . modules_get_agentmodule_name( $module_id ) . "\")'>" .
|
"\", 0, -1,\"" . modules_get_agentmodule_name( $module_id ) . "\")'>" .
|
||||||
html_print_image ("images/refresh.png", true, array ("style" => 'vertical-align: middle;', "border" => "0" )) .
|
html_print_image ("images/refresh.png", true, array ("style" => 'vertical-align: middle;', "border" => "0" )) .
|
||||||
"</a>";
|
"</a>";
|
||||||
$formtable->rowspan[0][3] = 2;
|
|
||||||
$formtable->cellstyle[0][3] = 'vertical-align: middle;';
|
|
||||||
|
|
||||||
$formtable->data[1][0] = html_print_radio_button_extended(
|
$formtable->data[1][0] = html_print_radio_button_extended(
|
||||||
"selection_mode", 'range','', $selection_mode, false, '',
|
"selection_mode", 'range','', $selection_mode, false, '',
|
||||||
|
@ -177,9 +186,6 @@ if ($get_module_detail) {
|
||||||
|
|
||||||
html_print_table($formtable);
|
html_print_table($formtable);
|
||||||
|
|
||||||
$moduletype_name = modules_get_moduletype_name(
|
|
||||||
modules_get_agentmodule_type($module_id));
|
|
||||||
|
|
||||||
$offset = (int) get_parameter("offset");
|
$offset = (int) get_parameter("offset");
|
||||||
$block_size = (int) $config["block_size"];
|
$block_size = (int) $config["block_size"];
|
||||||
|
|
||||||
|
@ -222,10 +228,10 @@ if ($get_module_detail) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$count = modules_get_agentmodule_data ($module_id, $period,
|
$count = modules_get_agentmodule_data ($module_id, $period,
|
||||||
$date, true, $conexion);
|
$date, true, $conexion, 'ASC', $freesearch);
|
||||||
|
|
||||||
$module_data = modules_get_agentmodule_data ($module_id, $period,
|
$module_data = modules_get_agentmodule_data ($module_id, $period,
|
||||||
$date, false, $conexion, 'DESC');
|
$date, false, $conexion, 'DESC', $freesearch);
|
||||||
|
|
||||||
if (empty($module_data)) {
|
if (empty($module_data)) {
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
|
@ -1720,7 +1720,8 @@ function modules_get_next_data ($id_agent_module, $utimestamp = 0, $string = 0)
|
||||||
* @return array The module value and the timestamp
|
* @return array The module value and the timestamp
|
||||||
*/
|
*/
|
||||||
function modules_get_agentmodule_data ($id_agent_module, $period,
|
function modules_get_agentmodule_data ($id_agent_module, $period,
|
||||||
$date = 0, $trash=false, $conexion = false, $order = 'ASC') {
|
$date = 0, $trash=false, $conexion = false, $order = 'ASC',
|
||||||
|
$freesearch = '') {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$module = db_get_row('tagente_modulo', 'id_agente_modulo',
|
$module = db_get_row('tagente_modulo', 'id_agente_modulo',
|
||||||
|
@ -1742,12 +1743,17 @@ function modules_get_agentmodule_data ($id_agent_module, $period,
|
||||||
case 17:
|
case 17:
|
||||||
//async_string
|
//async_string
|
||||||
case 23:
|
case 23:
|
||||||
$sql = sprintf ("SELECT datos AS data, utimestamp
|
$sql = sprintf (
|
||||||
FROM tagente_datos_string
|
"SELECT datos AS data, utimestamp FROM tagente_datos_string
|
||||||
WHERE id_agente_modulo = %d
|
WHERE id_agente_modulo = %d
|
||||||
AND utimestamp > %d AND utimestamp <= %d
|
%s
|
||||||
ORDER BY utimestamp %s",
|
AND utimestamp > %d AND utimestamp <= %d
|
||||||
$id_agent_module, $datelimit, $date, $order);
|
ORDER BY utimestamp %s",
|
||||||
|
$id_agent_module,
|
||||||
|
!empty($freesearch) ? " AND datos REGEXP '" . $freesearch . "' " : "",
|
||||||
|
$datelimit, $date,
|
||||||
|
$order
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
//log4x
|
//log4x
|
||||||
case 24:
|
case 24:
|
||||||
|
|
|
@ -364,6 +364,12 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri
|
||||||
|
|
||||||
extra_parameters = '&selection_mode=' + selection_mode + '&date_from=' + date_from + '&date_to=' + date_to + '&time_from=' + time_from + '&time_to=' + time_to;
|
extra_parameters = '&selection_mode=' + selection_mode + '&date_from=' + date_from + '&date_to=' + date_to + '&time_from=' + time_from + '&time_to=' + time_to;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the free text in both options
|
||||||
|
var freesearch = $('#text-freesearch').val();
|
||||||
|
if (freesearch == null) freesearch = '';
|
||||||
|
extra_parameters += '&freesearch=' + freesearch;
|
||||||
|
|
||||||
title = <?php echo "\"" . __("Module: ") . "\"" ?>;
|
title = <?php echo "\"" . __("Module: ") . "\"" ?>;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
|
|
Loading…
Reference in New Issue