mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 01:05:39 +02:00
2009-11-18 Miguel de Dios <miguel.dedios@artica.es>
* operation/agentes/exportdata.php: change "search_agents" in the ajax, now you can add paramater "add" as array json with the names of agents or other things that you want show in the box of result. * operation/events/events.php: change the select box for a ajax autocomplete box for agent form filter. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2113 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
c6023d91c5
commit
962269e152
@ -1,3 +1,11 @@
|
|||||||
|
2009-11-18 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* operation/agentes/exportdata.php: change "search_agents" in the ajax, now
|
||||||
|
you can add paramater "add" as array json with the names of agents or other
|
||||||
|
things that you want show in the box of result.
|
||||||
|
* operation/events/events.php: change the select box for a ajax autocomplete
|
||||||
|
box for agent form filter.
|
||||||
|
|
||||||
2009-11-16 Miguel de Dios <miguel.dedios@artica.es>
|
2009-11-16 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* godmode/reporting/reporting_builder.php,
|
* godmode/reporting/reporting_builder.php,
|
||||||
|
@ -23,6 +23,14 @@ if (is_ajax ()) {
|
|||||||
$id_agent = (int) get_parameter ('id_agent');
|
$id_agent = (int) get_parameter ('id_agent');
|
||||||
$string = (string) get_parameter ('q'); /* q is what autocomplete plugin gives */
|
$string = (string) get_parameter ('q'); /* q is what autocomplete plugin gives */
|
||||||
$id_group = (int) get_parameter('id_group');
|
$id_group = (int) get_parameter('id_group');
|
||||||
|
$addedItems = html_entity_decode((string) get_parameter('add'));
|
||||||
|
$addedItems = json_decode($addedItems);
|
||||||
|
|
||||||
|
if ($addedItems != null) {
|
||||||
|
foreach ($addedItems as $item) {
|
||||||
|
echo $item . "|\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$filter = array ();
|
$filter = array ();
|
||||||
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
|
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
|
||||||
|
@ -99,7 +99,20 @@ $search = preg_replace ("/&([A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "%", rawurlde
|
|||||||
$event_type = get_parameter ("event_type", ''); // 0 all
|
$event_type = get_parameter ("event_type", ''); // 0 all
|
||||||
$severity = (int) get_parameter ("severity", -1); // -1 all
|
$severity = (int) get_parameter ("severity", -1); // -1 all
|
||||||
$status = (int) get_parameter ("status", 0); // -1 all, 0 only red, 1 only green
|
$status = (int) get_parameter ("status", 0); // -1 all, 0 only red, 1 only green
|
||||||
$id_agent = (int) get_parameter ("id_agent", -1); //-1 all, 0 system
|
//$id_agent = (int) get_parameter ("id_agent", -1); //-1 all, 0 system
|
||||||
|
$text_agent = (string) get_parameter("id_agent", "All");
|
||||||
|
switch ($text_agent)
|
||||||
|
{
|
||||||
|
case 'All':
|
||||||
|
$id_agent = -1;
|
||||||
|
break;
|
||||||
|
case 'Server':
|
||||||
|
$id_agent = 0;
|
||||||
|
default:
|
||||||
|
$id_agent = get_agent_id($text_agent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$id_event = (int) get_parameter ("id_event", -1);
|
$id_event = (int) get_parameter ("id_event", -1);
|
||||||
$pagination = (int) get_parameter ("pagination", $config["block_size"]);
|
$pagination = (int) get_parameter ("pagination", $config["block_size"]);
|
||||||
$groups = get_user_groups ($config["id_user"], "IR");
|
$groups = get_user_groups ($config["id_user"], "IR");
|
||||||
@ -241,18 +254,30 @@ echo '</td>';
|
|||||||
|
|
||||||
//Agent search
|
//Agent search
|
||||||
echo "<td>".__('Agent search')."</td><td>";
|
echo "<td>".__('Agent search')."</td><td>";
|
||||||
$sql = "SELECT DISTINCT(id_agente) AS id_agent FROM tevento WHERE 1=1 ".$sql_post;
|
//$sql = "SELECT DISTINCT(id_agente) AS id_agent FROM tevento WHERE 1=1 ".$sql_post;
|
||||||
$result = get_db_all_rows_sql ($sql);
|
//$result = get_db_all_rows_sql ($sql);
|
||||||
|
//
|
||||||
|
//if ($result === false)
|
||||||
|
// $result = array();
|
||||||
|
//
|
||||||
|
//$agents = array ();
|
||||||
|
//$agents[-1] = __('All');
|
||||||
|
//
|
||||||
|
//if (is_user_admin ($config["id_user"])) {
|
||||||
|
// $agents[0] = __('System');
|
||||||
|
//}
|
||||||
|
|
||||||
if ($result === false)
|
|
||||||
$result = array();
|
|
||||||
|
|
||||||
$agents = array ();
|
//foreach ($result as $id_row) {
|
||||||
$agents[-1] = __('All');
|
// $name_for_combo = "";
|
||||||
|
// if ($id_row["id_agent"] > 0)
|
||||||
|
// $name_for_combo = mb_substr (get_agent_name ($id_row["id_agent"], "lower"),0,20);
|
||||||
|
//
|
||||||
|
// if ($name_for_combo != "")
|
||||||
|
// $agents[$id_row["id_agent"]] = $name_for_combo;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
if (is_user_admin ($config["id_user"])) {
|
|
||||||
$agents[0] = __('System');
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($result as $id_row) {
|
foreach ($result as $id_row) {
|
||||||
$name_for_combo = "";
|
$name_for_combo = "";
|
||||||
@ -263,7 +288,11 @@ foreach ($result as $id_row) {
|
|||||||
$agents[$id_row["id_agent"]] = $name_for_combo;
|
$agents[$id_row["id_agent"]] = $name_for_combo;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_select ($agents, 'id_agent', $id_agent, '', '', '');
|
print_input_text_extended ('id_agent', $text_agent, 'text_id_agent', '', 30, 100, false, '',
|
||||||
|
array('style' => 'background: url(images/lightning.png) no-repeat right;'))
|
||||||
|
. '<a href="#" class="tip"> <span>' . __("Type two chars at least for search") . '</span></a>';
|
||||||
|
|
||||||
|
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
|
|
||||||
// User selectable block size
|
// User selectable block size
|
||||||
@ -491,10 +520,10 @@ foreach ($result as $event) {
|
|||||||
else {
|
else {
|
||||||
if (!empty ($event["estado"])) {
|
if (!empty ($event["estado"])) {
|
||||||
if ($event["id_usuario"] != '0' && $event["id_usuario"] != ''){
|
if ($event["id_usuario"] != '0' && $event["id_usuario"] != ''){
|
||||||
$data[7] = '<a href="index.php?sec=usuario&sec2=operation/user/user_edit&ver='.$event["id_usuario"].'" title="'.dame_nombre_real ($event["id_usuario"]).'">'.mb_substr ($event["id_usuario"],0,8).'</a>';
|
$data[7] = '<a href="index.php?sec=usuario&sec2=operation/user/user_edit&ver='.$event["id_usuario"].'" title="'.dame_nombre_real ($event["id_usuario"]).'">'.mb_substr ($event["id_usuario"],0,8).'</a>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$data[7] = __('System');
|
$data[7] = __('System');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -556,16 +585,48 @@ if (!empty ($table->data)) {
|
|||||||
}
|
}
|
||||||
echo '</div></form>';
|
echo '</div></form>';
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
echo '<div class="nf">'.__('No events').'</div>';
|
echo '<div class="nf">'.__('No events').'</div>';
|
||||||
}
|
}
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
unset ($table);
|
unset ($table);
|
||||||
|
|
||||||
|
require_jquery_file ('bgiframe');
|
||||||
|
require_jquery_file ('autocomplete');
|
||||||
?>
|
?>
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
/* <![CDATA[ */
|
/* <![CDATA[ */
|
||||||
|
|
||||||
$(document).ready( function() {
|
$(document).ready( function() {
|
||||||
|
|
||||||
|
$("#text_id_agent").autocomplete(
|
||||||
|
"ajax.php",
|
||||||
|
{
|
||||||
|
minChars: 2,
|
||||||
|
scroll:true,
|
||||||
|
extraParams: {
|
||||||
|
page: "operation/agentes/exportdata",
|
||||||
|
search_agents: 1,
|
||||||
|
add: '<?php echo json_encode(array('-1' => "All", '0' => "System"));?>',
|
||||||
|
id_group: function() { return $("#id_group").val(); }
|
||||||
|
},
|
||||||
|
formatItem: function (data, i, total) {
|
||||||
|
if (total == 0)
|
||||||
|
$("#text_id_agent").css ('background-color', '#cc0000');
|
||||||
|
else
|
||||||
|
$("#text_id_agent").css ('background-color', '');
|
||||||
|
if (data == "")
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return data[0]+'<br><span class="ac_extra_field"><?php echo __("IP") ?>: '+data[1]+'</span>';
|
||||||
|
},
|
||||||
|
delay: 200
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
$("input[name=allbox]").change (function() {
|
$("input[name=allbox]").change (function() {
|
||||||
$("input[name='eventid[]']").attr('checked', $(this).attr('checked'));
|
$("input[name='eventid[]']").attr('checked', $(this).attr('checked'));
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user