2009-06-09 Esteban Sanchez <estebans@artica.es>

* godmode/agentes/agent_manager.php: Fixed string filter when
        searching agents. Avoids a PHP notice when none found

        * godmode/agentes/configurar_agente.php: Solved a mess with variable
        names.

        * godmode/agentes/module_manager_editor_prediction.php: Improved
        the prediction module selection, adding a filter for agents and
        module. Fixes 

        * include/javascript/jquery.pandora.controls.js: Returns
        whenever callbackBefore returns false.

        * include/javascript/pandora_modules.js: Check for module selection
        when creating a prediction one.

        * include/styles/pandora.css: Added style to prediction module
        selection.

        * godmode/alerts/alert_list.php: callbackBefore on pandora.controls
        elements must return true now.

        * godmode/agentes/module_manager_editor_common.php: Added moduletype
        hidden input to be used in javascript.

        * godmode/agentes/module_manager_editor.php: Use pandora.controls and
        added a string for javascript.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1744 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
esanchezm 2009-06-09 14:29:03 +00:00
parent 00112072f4
commit 8dac9aa36d
10 changed files with 114 additions and 20 deletions

View File

@ -1,3 +1,33 @@
2009-06-09 Esteban Sanchez <estebans@artica.es>
* godmode/agentes/agent_manager.php: Fixed string filter when
searching agents. Avoids a PHP notice when none found
* godmode/agentes/configurar_agente.php: Solved a mess with variable
names.
* godmode/agentes/module_manager_editor_prediction.php: Improved
the prediction module selection, adding a filter for agents and
module. Fixes #2707907
* include/javascript/jquery.pandora.controls.js: Returns
whenever callbackBefore returns false.
* include/javascript/pandora_modules.js: Check for module selection
when creating a prediction one.
* include/styles/pandora.css: Added style to prediction module
selection.
* godmode/alerts/alert_list.php: callbackBefore on pandora.controls
elements must return true now.
* godmode/agentes/module_manager_editor_common.php: Added moduletype
hidden input to be used in javascript.
* godmode/agentes/module_manager_editor.php: Use pandora.controls and
added a string for javascript.
2009-06-09 Esteban Sanchez <estebans@artica.es>
* godmode/reporting/reporting_builder.php: Fixed a couple of typo

View File

@ -23,10 +23,12 @@ if (is_ajax ()) {
$string = (string) get_parameter ('q'); /* q is what autocomplete plugin gives */
$filter = array ();
$filter[] = 'nombre LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%"';
$filter[] = '(nombre LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
$filter[] = 'id_agente != '.$id_agent;
$agents = get_agents ($filter, array ('nombre', 'direccion'));
if ($agents === false)
return;
foreach ($agents as $agent) {
echo $agent['nombre']."|".$agent['direccion']."\n";

View File

@ -376,7 +376,6 @@ if ($update_module || $create_module) {
$min = (int) get_parameter_post ("min");
$max = (int) get_parameter ('max');
$interval = (int) get_parameter ('module_interval', $intervalo);
$id_prediction_module = (int) get_parameter ('id_prediction_module');
$id_plugin = (int) get_parameter ('id_plugin');
$id_export = (int) get_parameter ('id_export');
$disabled = (bool) get_parameter ('disabled');
@ -477,7 +476,7 @@ if ($create_module) {
'plugin_parameter' => $plugin_parameter,
'id_plugin' => $id_plugin,
'post_process' => $post_process,
'prediction_module' => $id_prediction_module,
'prediction_module' => $prediction_module,
'max_timeout' => $max_timeout,
'disabled' => $disabled,
'id_modulo' => $id_module,

View File

@ -236,6 +236,7 @@ echo '</form>';
require_jquery_file ('ui');
require_jquery_file ('form');
require_jquery_file ('pandora');
require_jquery_file ('pandora.controls');
require_javascript_file ('pandora_modules');
?>
@ -244,6 +245,7 @@ require_javascript_file ('pandora_modules');
var no_name_lang = "<?php echo __('No module name provided') ?>";
var no_target_lang = "<?php echo __('No target IP provided') ?>";
var no_oid_lang = "<?php echo __('No SNMP OID provided') ?>";
var no_prediction_module_lang = "<?php echo __('No module to predict') ?>";
$(document).ready (function () {
configure_modules_form ();

View File

@ -93,6 +93,8 @@ require_once ('include/functions_network_components.php');
$update_module_id = (int) get_parameter_get ('update_module');
print_input_hidden ('moduletype', $moduletype);
$table_simple->id = 'simple';
$table_simple->width = '90%';
$table_simple->class = 'databox_color';

View File

@ -18,16 +18,34 @@ $extra_title = __('Prediction server module');
$data = array ();
$data[0] = __('Source module');
$data[0] .= print_help_icon ('prediction_source_module', true);
$agents = get_group_agents (array_keys (get_user_groups ($config["id_user"], "AW")));
$fields = array ();
foreach ($agents as $agent_id => $agent_name) {
$modules = get_agent_modules ($agent_id, false, 'disabled = 0 AND history_data = 1');
foreach ($modules as $module_id => $module_name) {
$fields[$module_id] = $agent_name.' / '.$module_name;
}
$groups = get_user_groups ($config["id_user"], "AR");
$agents = get_group_agents (array_keys ($groups));
if ($prediction_module) {
$prediction_id_agent = get_agentmodule_agent ($prediction_module);
$prediction_id_group = get_agent_group ($prediction_id_agent);
} else {
$prediction_id_agent = $id_agente;
$prediction_id_group = get_agent_group ($id_agente);
}
$data[1] = print_select ($fields, 'prediction_module', $prediction_module, '',
$modules = get_agent_modules ($prediction_id_agent, false, 'disabled = 0 AND history_data = 1');
$data[1] = '<label for="prediction_id_group">'.__('Group').'</label>';
$data[1] .= print_select ($groups, 'prediction_id_group', $prediction_id_group, '',
'', '', true);
$data[1] .= ' <span id="agent_loading" class="invisible">';
$data[1] .= '<img src="images/spinner.gif" />';
$data[1] .= '</span>';
$data[1] .= '<label for="prediction_id_agent">'.__('Agent').'</label>';
$data[1] .= print_select ($agents, 'prediction_id_agent', $prediction_id_agent, '',
'', '', true);
$data[1] .= ' <span id="module_loading" class="invisible">';
$data[1] .= '<img src="images/spinner.gif" />';
$data[1] .= '</span>';
$data[1] .= '<label for="prediction_module">'.__('Module').'</label>';
$data[1] .= print_select ($modules, 'prediction_module', $prediction_module, '',
'', '', true);
$table_simple->colspan['prediction_module'][1] = 3;
push_table_simple ($data, 'prediction_module');

View File

@ -417,8 +417,7 @@ $(document).ready (function () {
$select = $("#id_agent_module").disable ();
$select.siblings ("span#latest_value").hide ();
$("option[value!=0]", $select).remove ();
},
callbackAfter: function () {
return true;
}
});

View File

@ -1,6 +1,6 @@
(function($) {
var dummyFunc = function () {
return;
return true;
};
$.extend ({
@ -27,7 +27,8 @@
var $select = $(config.agentSelect).disable ();
$(config.loading).show ();
$("option[value!=0]", $select).remove ();
config.callbackBefore (this);
if (! config.callbackBefore (this))
return;
jQuery.post ("ajax.php",
{"page" : "godmode/groups/group_list",
@ -81,7 +82,8 @@
var $select = $(config.moduleSelect).disable ();
$(config.loading).show ();
$("option[value!=0]", $select).remove ();
config.callbackBefore (this);
if (! config.callbackBefore (this))
return;
jQuery.post ('ajax.php',
{"page": "operation/agentes/ver_agente",
@ -136,7 +138,8 @@
var $select = $(config.alertSelect).disable ();
$(config.loading).show ();
$("option[value!=0]", $select).remove ();
config.callbackBefore (this);
if (! config.callbackBefore (this))
return;
jQuery.post ('ajax.php',
{"page": "godmode/alerts/alert_list",

View File

@ -148,17 +148,26 @@ function configure_modules_form () {
});
$("form#module_form").submit (function () {
if ($("#text-name").attr ("value") == "") {
if ($("#text-name").val () == "") {
$("#text-name").focus ();
$("#message").showMessage (no_name_lang);
return false;
}
moduletype = $("#hidden-moduletype").val ();
if (moduletype == 5) {
if ($("#prediction_module").val () == null) {
$("#prediction_module").focus ();
$("#message").showMessage (no_module_lang);
return false;
}
}
module = $("#id_module_type").attr ("value");
if (id_modules_icmp.in_array (module) || id_modules_tcp.in_array (module) || id_modules_snmp.in_array (module)) {
/* Network module */
if ($("#text-ip_target").attr ("value") == "") {
if ($("#text-ip_target").val () == "") {
$("#text-ip_target").focus ();
$("#message").showMessage (no_target_lang);
return false;
@ -177,4 +186,24 @@ function configure_modules_form () {
$("#message").hide ();
return true;
});
$("#prediction_id_group").pandoraSelectGroupAgent ({
agentSelect: "select#prediction_id_agent",
callbackBefore: function () {
$("#module_loading").show ();
$("#prediction_module option").remove ();
return true;
},
callbackAfter: function (e) {
if ($("#prediction_id_agent").children ().length == 0) {
$("#module_loading").hide ();
return;
}
$("#prediction_id_agent").change ();
}
});
$("#prediction_id_agent").pandoraSelectAgentModule ({
moduleSelect: "select#prediction_module"
});
}

View File

@ -780,9 +780,14 @@ table#simple select#id_plugin,
table#network_component select#id_plugin {
width: 270px;
}
table#simple select#prediction_id_group,
table#simple select#prediction_id_agent,
table#simple select#prediction_module {
width: 50%;
display: block;
}
table#simple input#text-plugin_parameter,
table#simple input#text-snmp_oid,
table#simple select#prediction_module,
table#source_table select,
table#destiny_table select,
table#target_table select,
@ -800,6 +805,11 @@ table#simple span#component {
width: 45%;
font-style: italic;
}
table#simple label {
display: inline;
font-weight: normal;
font-style: italic;
}
.clickable {
cursor: pointer;
}