2010-11-03 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: added the function "print_autocomplete_modules". This function is same to magic-select box for agents instead this for modules. * include/javascript/jquery.ui.datepicker.js, include/javascript/jquery.ui.droppable.js: fixed end of lines that it haven't semicolon end char. * include/ajax/module.php: fix version of file that responds to ajax request for the magic-select box for modules. * include/functions_ui.php: in function "format_alert_row" use new call for the "isAlertInPolicy2". * include/functions_db.php: added in function "get_agent_modules" for the parameter $filter, the posibility to search with the "like" mysql operator. * images/lightning_blue.png: blue lighting for new magic-select box agents. * godmode/agentes/configurar_agente.php: cleaned source code style. * godmode/alerts/alert_list.list.php: use new call for the "isAlertInPolicy2". And fixed the column align for policies and actions. * godmode/reporting/reporting_builder.list_items.php: erased old source code lines comments. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3509 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
e80cff83de
commit
7957ca1e07
|
@ -1,3 +1,32 @@
|
|||
2010-11-03 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_html.php: added the function
|
||||
"print_autocomplete_modules". This function is same to magic-select box for
|
||||
agents instead this for modules.
|
||||
|
||||
* include/javascript/jquery.ui.datepicker.js,
|
||||
include/javascript/jquery.ui.droppable.js: fixed end of lines that it
|
||||
haven't semicolon end char.
|
||||
|
||||
* include/ajax/module.php: fix version of file that responds to ajax
|
||||
request for the magic-select box for modules.
|
||||
|
||||
* include/functions_ui.php: in function "format_alert_row" use new call
|
||||
for the "isAlertInPolicy2".
|
||||
|
||||
* include/functions_db.php: added in function "get_agent_modules" for the
|
||||
parameter $filter, the posibility to search with the "like" mysql operator.
|
||||
|
||||
* images/lightning_blue.png: blue lighting for new magic-select box agents.
|
||||
|
||||
* godmode/agentes/configurar_agente.php: cleaned source code style.
|
||||
|
||||
* godmode/alerts/alert_list.list.php: use new call for the
|
||||
"isAlertInPolicy2". And fixed the column align for policies and actions.
|
||||
|
||||
* godmode/reporting/reporting_builder.list_items.php: erased old source
|
||||
code lines comments.
|
||||
|
||||
2010-11-03 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* pandoradb_data.sql: Updated build
|
||||
|
|
|
@ -721,7 +721,7 @@ if ($create_module) {
|
|||
|
||||
// MODULE DELETION
|
||||
// =================
|
||||
if ($delete_module){ // DELETE agent module !
|
||||
if ($delete_module) { // DELETE agent module !
|
||||
$id_borrar_modulo = (int) get_parameter_get ("delete_module",0);
|
||||
$module_data = get_db_row ('tagente_modulo', 'id_agente_modulo', $id_borrar_modulo);
|
||||
$id_grupo = (int) dame_id_grupo ($id_agente);
|
||||
|
|
|
@ -334,8 +334,11 @@ $table->valign[6] = 'middle';
|
|||
$table->valign[7] = 'middle';
|
||||
$table->valign[8] = 'middle';
|
||||
$table->align[2] = 'center';
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->align[5] = 'center';
|
||||
}
|
||||
$table->align[4] = 'center';
|
||||
$table->align[6] = 'center';
|
||||
$table->align[6] = 'left';
|
||||
$table->align[7] = 'center';
|
||||
$table->align[8] = 'center';
|
||||
|
||||
|
@ -403,14 +406,14 @@ foreach ($simple_alerts as $alert) {
|
|||
$data[4] .= "</a>";
|
||||
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$policyInfo = isAlertInPolicy($alert['id_agent_module'], $alert['id_alert_template'], false);
|
||||
$policyInfo = isAlertInPolicy2($alert['id'], false);
|
||||
if ($policyInfo === false)
|
||||
$data[5] = '';
|
||||
else {
|
||||
$img = 'images/policies.png';
|
||||
|
||||
$data[5] = '<a href="?sec=gpolicies&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id_policy'] . '">' .
|
||||
print_image($img,true, array('title' => $policyInfo['name_policy'])) .
|
||||
$data[5] = '<a href="?sec=gpolicies&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id'] . '">' .
|
||||
print_image($img,true, array('title' => $policyInfo['name'])) .
|
||||
'</a>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -216,8 +216,6 @@ foreach ($items as $item) {
|
|||
|
||||
$row[4] = human_time_description_raw($item['period']);
|
||||
|
||||
//. '<a href="#" class="tip"> <span>' . __("Type at least two<br><br><br>characters to search") . '</span></a>';
|
||||
|
||||
if ($item['description'] == '') {
|
||||
$row[5] = '-';
|
||||
}
|
||||
|
@ -225,13 +223,6 @@ foreach ($items as $item) {
|
|||
$row[5] = printTruncateText($item['description'], 25, true, true);
|
||||
}
|
||||
|
||||
// if ($item['id_gs'] == null) {
|
||||
// $row[5] = '-';
|
||||
// }
|
||||
// else {
|
||||
// $row[5] = get_db_value_filter('name', 'tgraph', array('id_graph' => $item['id_gs']));
|
||||
// }
|
||||
|
||||
$row[6] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=edit&id_report=' . $idReport . '&id_item=' . $item['id_rc'] . '"><img src="images/wrench_orange.png" title="' . __('Edit') . '" /></a>';
|
||||
$row[6] .= ' ';
|
||||
$row[6] .= '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=delete&id_report=' . $idReport . '&id_item=' . $item['id_rc'] . $urlFilter . '"><img src="images/cross.png" title="' . __('Delete') . '" /></a>';
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 628 B |
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
//Pandora FMS- http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
$search_modules = get_parameter('search_modules');
|
||||
|
||||
if ($search_modules) {
|
||||
$id_agents = json_decode(safe_output(get_parameter('id_agents')));
|
||||
$filter = get_parameter('q', '') . '%';
|
||||
$other_filter = json_decode(safe_output(get_parameter('other_filter')), true);
|
||||
|
||||
$modules = get_agent_modules($id_agents, false, (array('nombre' => $filter) + $other_filter));
|
||||
|
||||
if ($modules === false) $modules = array();
|
||||
$modules = array_unique($modules);
|
||||
|
||||
foreach ($modules as $module) {
|
||||
echo $module . "\n";
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -663,7 +663,8 @@ function get_agent_modules ($id_agent, $details = false, $filter = false, $index
|
|||
|
||||
if ($where != '') {
|
||||
$where .= ' AND ';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$where .= ' WHERE ';
|
||||
}
|
||||
|
||||
|
@ -674,17 +675,27 @@ function get_agent_modules ($id_agent, $details = false, $filter = false, $index
|
|||
if (is_array ($filter)) {
|
||||
$fields = array ();
|
||||
foreach ($filter as $field => $value) {
|
||||
array_push ($fields, $field.'="'.$value.'"');
|
||||
if ($value[0] == '%') {
|
||||
array_push ($fields, $field.' LIKE "'.$value.'"');
|
||||
}
|
||||
else if (substr($value, -1) == '%') {
|
||||
array_push ($fields, $field.' LIKE "'.$value.'"');
|
||||
}
|
||||
else {
|
||||
array_push ($fields, $field.' = "'.$value.'"');
|
||||
}
|
||||
}
|
||||
$where .= implode (' AND ', $fields);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$where .= $filter;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty ($details)) {
|
||||
$details = "nombre";
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$details = safe_input ($details);
|
||||
}
|
||||
|
||||
|
|
|
@ -1241,4 +1241,120 @@ function html2rgb($htmlcolor)
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a magic-ajax control to select the module.
|
||||
*
|
||||
* @param string $name The name of ajax control, by default is "module".
|
||||
* @param string $default The default value to show in the ajax control.
|
||||
* @param array $id_agents The array list of id agents as array(1,2,3), by default is false and the function use all agents (if the ACL desactive).
|
||||
* @param bool $ACL Filter the agents by the ACL list of user.
|
||||
* @param string $scriptResult The source code of script to call, by default is
|
||||
* empty. And the example is:
|
||||
* function (e, data, formatted) {
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* And the formatted is the select item as string.
|
||||
*
|
||||
* @param array $filter Other filter of modules.
|
||||
* @param bool $return If it is true return a string with the output instead to echo the output.
|
||||
*
|
||||
* @return mixed If the $return is true, return the output as string.
|
||||
*/
|
||||
function print_autocomplete_modules($name = 'module', $default = '', $id_agents = false, $ACL = true, $scriptResult = '', $filter = array(), $return = false) {
|
||||
global $config;
|
||||
|
||||
if ($id_agents === false) {
|
||||
$groups = array();
|
||||
if ($ACL) {
|
||||
$groups = get_user_groups($config['id_user'], "AW", false);
|
||||
$groups = array_keys($groups);
|
||||
|
||||
$agents = get_db_all_rows_sql('SELECT id_agente FROM tagente WHERE id_grupo IN (' . implode(',', $groups) . ')');
|
||||
}
|
||||
else {
|
||||
$agents = get_db_all_rows_sql('SELECT id_agente FROM tagente');
|
||||
}
|
||||
|
||||
if ($agents === false) $agents = array();
|
||||
|
||||
$id_agents = array();
|
||||
foreach ($agents as $agent) {
|
||||
$id_agents[] = $agent['id_agente'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($ACL) {
|
||||
$groups = get_user_groups($config['id_user'], "AW", false);
|
||||
$groups = array_keys($groups);
|
||||
|
||||
$agents = get_db_all_rows_sql('SELECT id_agente FROM tagente WHERE id_grupo IN (' . implode(',', $groups) . ')');
|
||||
|
||||
if ($agents === false) $agents = array();
|
||||
|
||||
$id_agentsACL = array();
|
||||
foreach ($agents as $agent) {
|
||||
if (array_search($agent['id_agente'], $id_agents) !== false) {
|
||||
$id_agentsACL[] = $agent['id_agente'];
|
||||
}
|
||||
}
|
||||
|
||||
$id_agents = $id_agentsACL;
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
require_jquery_file ('autocomplete');
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
$("#text-<?php echo $name; ?>").autocomplete(
|
||||
"ajax.php",
|
||||
{
|
||||
minChars: 2,
|
||||
scroll:true,
|
||||
extraParams: {
|
||||
page: "include/ajax/module",
|
||||
search_modules: 1,
|
||||
id_agents: '<?php echo json_encode($id_agents); ?>',
|
||||
other_filter: '<?php echo json_encode($filter); ?>'
|
||||
},
|
||||
formatItem: function (data, i, total) {
|
||||
if (total == 0)
|
||||
$("#text-<?php echo $name; ?>").css ('background-color', '#cc0000');
|
||||
else
|
||||
$("#text-<?php echo $name; ?>").css ('background-color', '');
|
||||
|
||||
if (data == "")
|
||||
return false;
|
||||
|
||||
return data[0];
|
||||
},
|
||||
delay: 200
|
||||
}
|
||||
);
|
||||
|
||||
$("#text-<?php echo $name; ?>").result (
|
||||
<?php echo $scriptResult; ?>
|
||||
);
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
|
||||
print_input_text_extended ($name, $default, 'text-' . $name, '', 30, 100, false, '',
|
||||
array('style' => 'background: url(images/lightning_blue.png) no-repeat right;'));
|
||||
echo '<a href="#" class="tip"> <span>' . __("Type at least two characters to search the module.") . '</span></a>';
|
||||
|
||||
$output = ob_get_clean();
|
||||
|
||||
if ($return) {
|
||||
return $output;
|
||||
}
|
||||
else {
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -431,14 +431,14 @@ function format_alert_row ($alert, $compound = false, $agent = true, $url = '')
|
|||
$data = array ();
|
||||
|
||||
if (($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) && (!$compound)) {
|
||||
$policyInfo = isAlertInPolicy($alert['id_agent_module'], $alert['id_alert_template'], false);
|
||||
$policyInfo = isAlertInPolicy2($alert['id'], false);
|
||||
if ($policyInfo === false)
|
||||
$data[$index['policy']] = '';
|
||||
else {
|
||||
$img = 'images/policies.png';
|
||||
|
||||
$data[$index['policy']] = '<a href="?sec=gpolicies&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id_policy'] . '">' .
|
||||
print_image($img,true, array('title' => $policyInfo['name_policy'])) .
|
||||
$data[$index['policy']] = '<a href="?sec=gpolicies&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id'] . '">' .
|
||||
print_image($img,true, array('title' => $policyInfo['name'])) .
|
||||
'</a>';
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue