2013-02-27 Miguel de Dios <miguel.dedios@artica.es>

* godmode/agentes/module_manager_editor_common.php,
	godmode/agentes/modificar_agente.php,
	godmode/agentes/module_manager_editor.php,
	godmode/agentes/agent_manager.php: updated the code to module
	constants.
	
	* include/javascript/pandora_modules.js: fixed the set the
	module_data from to the json.
	
	* include/functions_api.php: cleaned source code style.
	
	* include/constants.php: addded lost constant for the module
	prediction.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7728 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-02-27 09:51:48 +00:00
parent eec4bbb4ae
commit 606e825895
8 changed files with 157 additions and 114 deletions

View File

@ -1,3 +1,19 @@
2013-02-27 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/module_manager_editor_common.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/module_manager_editor.php,
godmode/agentes/agent_manager.php: updated the code to module
constants.
* include/javascript/pandora_modules.js: fixed the set the
module_data from to the json.
* include/functions_api.php: cleaned source code style.
* include/constants.php: addded lost constant for the module
prediction.
2013-02-26 Sancho Lerena <slerena@artica.es>
* include/functions_filemanager.php: Fixed tooltips to use new format.

View File

@ -118,8 +118,10 @@ echo '<div style="height: 5px">&nbsp;</div>';
if (!$new_agent) {
// Agent remote configuration editor
$agent_md5 = md5 ($nombre_agente, false);
$filename['md5'] = $config["remote_config"]."/md5/".$agent_md5.".md5";
$filename['conf'] = $config["remote_config"]."/conf/".$agent_md5.".conf";
$filename['md5'] = $config["remote_config"] . "/md5/" .
$agent_md5 . ".md5";
$filename['conf'] = $config["remote_config"] . "/conf/" .
$agent_md5 . ".conf";
}
$disk_conf = (bool) get_parameter ('disk_conf');

View File

@ -186,11 +186,15 @@ switch ($sortField) {
switch ($sort) {
case 'up':
$selectNameUp = $selected;
$order = array('field' => 'nombre COLLATE utf8_general_ci', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
$order = array('field' => 'nombre COLLATE utf8_general_ci',
'field2' => 'nombre COLLATE utf8_general_ci',
'order' => 'ASC');
break;
case 'down':
$selectNameDown = $selected;
$order = array('field' => 'nombre COLLATE utf8_general_ci', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC');
$order = array('field' => 'nombre COLLATE utf8_general_ci',
'field2' => 'nombre COLLATE utf8_general_ci',
'order' => 'DESC');
break;
}
break;
@ -198,11 +202,15 @@ switch ($sortField) {
switch ($sort) {
case 'up':
$selectOsUp = $selected;
$order = array('field' => 'id_os', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
$order = array('field' => 'id_os',
'field2' => 'nombre COLLATE utf8_general_ci',
'order' => 'ASC');
break;
case 'down':
$selectOsDown = $selected;
$order = array('field' => 'id_os', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC');
$order = array('field' => 'id_os',
'field2' => 'nombre COLLATE utf8_general_ci',
'order' => 'DESC');
break;
}
break;
@ -210,11 +218,15 @@ switch ($sortField) {
switch ($sort) {
case 'up':
$selectGroupUp = $selected;
$order = array('field' => 'id_grupo', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
$order = array('field' => 'id_grupo',
'field2' => 'nombre COLLATE utf8_general_ci',
'order' => 'ASC');
break;
case 'down':
$selectGroupDown = $selected;
$order = array('field' => 'id_grupo', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC');
$order = array('field' => 'id_grupo',
'field2' => 'nombre COLLATE utf8_general_ci',
'order' => 'DESC');
break;
}
break;
@ -255,7 +267,8 @@ if ($ag_group > 0) {
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s, %s %s LIMIT %d, %d',
ORDER BY %s, %s %s
LIMIT %d, %d',
implode (",", $ag_groups), $search_sql, $order['field'], $order['field2'], $order['order'], $offset, $config["block_size"]);
break;
case "postgresql":
@ -263,7 +276,8 @@ if ($ag_group > 0) {
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s, %s %s LIMIT %d OFFSET %d',
ORDER BY %s, %s %s
LIMIT %d OFFSET %d',
implode (",", $ag_groups), $search_sql, $order['field'], $order['field2'], $order['order'], $config["block_size"], $offset);
break;
case "oracle":
@ -288,13 +302,17 @@ else {
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ('SELECT *
FROM tagente WHERE 1=1 %s
FROM tagente
WHERE 1=1
%s
ORDER BY %s, %s %s LIMIT %d, %d', $search_sql, $order['field'], $order['field2'],
$order['order'], $offset, $config["block_size"]);
break;
case "postgresql":
$sql = sprintf ('SELECT *
FROM tagente WHERE 1=1 %s
FROM tagente
WHERE 1=1
%s
ORDER BY %s, %s %s LIMIT %d OFFSET %d', $search_sql, $order['field'], $order['field2'],
$order['order'], $config["block_size"], $offset);
break;
@ -303,7 +321,9 @@ else {
$set['limit'] = $config["block_size"];
$set['offset'] = $offset;
$sql = sprintf ('SELECT *
FROM tagente WHERE 1=1 %s
FROM tagente
WHERE 1=1
%s
ORDER BY %s, %s %s', $search_sql, $order['field'], $order['field2'], $order['order']);
$sql = oracle_recode_query ($sql, $set);
break;
@ -331,7 +351,8 @@ else {
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s, %s %s LIMIT %d, %d',
ORDER BY %s, %s %s
LIMIT %d, %d',
implode (',', array_keys ($user_groups)),
$search_sql, $order['field'], $order['field2'], $order['order'], $offset, $config["block_size"]);
break;
@ -340,7 +361,8 @@ else {
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s, %s %s LIMIT %d OFFSET %d',
ORDER BY %s, %s %s
LIMIT %d OFFSET %d',
implode (',', array_keys ($user_groups)),
$search_sql, $order['field'], $order['field2'], $order['order'], $config["block_size"], $offset);
break;
@ -532,7 +554,8 @@ if(check_acl ($config["id_user"], 0, "AW")) {
echo '<a name="bottom">';
echo '<form method="post" action="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente">';
html_print_input_hidden ('new_agent', 1);
html_print_submit_button (__('Create agent'), 'crt', false, 'class="sub next"');
html_print_submit_button (__('Create agent'), 'crt', false,
'class="sub next"');
echo "</form>";
}
@ -554,11 +577,6 @@ $(document).ready (function () {
$(this).css ("min-width", "100px");
});
/* $("#ag_group").hover (
function () {
$(this).css ("width", "auto");
});*/
$("#ag_group").blur (function () {
$(this).css ("width", "100px");
});

View File

@ -328,11 +328,12 @@ $remote_conf = false;
switch ($moduletype) {
case "dataserver":
case 1:
$moduletype = 1;
case MODULE_DATA:
$moduletype = MODULE_DATA;
// Has remote configuration ?
$agent_md5 = md5 (agents_get_name($id_agente), false);
$remote_conf = file_exists ($config["remote_config"]."/md5/".$agent_md5.".md5");
$remote_conf = file_exists ($config["remote_config"] ."/md5/" .
$agent_md5 . ".md5");
/* Categories is an array containing the allowed module types
(generic_data, generic_string, etc) from ttipo_modulo (field categoria) */
@ -349,31 +350,31 @@ switch ($moduletype) {
}
break;
case "networkserver":
case 2:
$moduletype = 2;
case MODULE_NETWORK:
$moduletype = MODULE_NETWORK;
$categories = array (3, 4, 5);
require ('module_manager_editor_common.php');
require ('module_manager_editor_network.php');
break;
case "pluginserver":
case 4:
$moduletype = 4;
case MODULE_PLUGIN:
$moduletype = MODULE_PLUGIN;
$categories = array (0, 1, 2);
require ('module_manager_editor_common.php');
require ('module_manager_editor_plugin.php');
break;
case "predictionserver":
case 5:
$moduletype = 5;
case MODULE_PREDICTION:
$moduletype = MODULE_PREDICTION;
$categories = array (0, 1);
require ('module_manager_editor_common.php');
require ('module_manager_editor_prediction.php');
break;
case "wmiserver":
case 6:
$moduletype = 6;
case MODULE_WMI:
$moduletype = MODULE_WMI;
$categories = array (0, 1, 2);
require ('module_manager_editor_common.php');

View File

@ -157,8 +157,7 @@ if (isset($id_agent_module)) {
$edit = true;
}
}
else
{
else {
//Run into a policy
$edit = true;
}
@ -372,7 +371,8 @@ $table_advanced->data[6][4] = html_print_select_from_sql (
$table_advanced->data[7][0] = __('Quiet');
$table_advanced->data[7][0] .= ui_print_help_tip(__('The module still stores data but the alerts and events will be stop'), true);
$table_advanced->colspan[7][1] = 4;
$table_advanced->data[7][1] = html_print_checkbox('quiet_module', 1, $quiet_module, true);
$table_advanced->data[7][1] = html_print_checkbox('quiet_module', 1,
$quiet_module, true);
$table_advanced->data[8][0] = __('Critical instructions'). ui_print_help_tip(__("Instructions when the status is critical"), true);
$table_advanced->data[8][1] = html_print_textarea ('critical_instructions', 2, 65, $critical_instructions, '', true);
@ -391,10 +391,12 @@ $table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour, $minu
$table_advanced->colspan[11][1] = 4;
$table_advanced->data[12][0] = __('Timeout');
$table_advanced->data[12][1] = html_print_input_text ('max_timeout', $max_timeout, '', 5, 10, true);
$table_advanced->data[12][1] = html_print_input_text ('max_timeout',
$max_timeout, '', 5, 10, true);
$table_advanced->data[12][2] = '';
$table_advanced->data[12][3] = __('Retries');
$table_advanced->data[12][4] = html_print_input_text ('max_retries', $max_retries, '', 5, 10, true);
$table_advanced->data[12][4] = html_print_input_text ('max_retries',
$max_retries, '', 5, 10, true);
if (check_acl ($config['id_user'], 0, "PM")) {
$table_advanced->data[13][0] = __('Category');

View File

@ -228,6 +228,7 @@ define ('MODULE_DATA', 1);
define ('MODULE_NETWORK', 2);
define ('MODULE_SNMP', 2);
define ('MODULE_PLUGIN', 4);
define ('MODULE_PREDICTION', 5);
define ('MODULE_WMI', 6);
define ('MODULE_WEB', 7);

View File

@ -108,7 +108,7 @@ function configure_modules_form () {
configuration_data = js_html_entity_decode (data['data']);
$("#text-name").attr ("value", js_html_entity_decode (data["name"]));
$("#textarea_description").attr ("value", js_html_entity_decode (data["description"]));
$("#textarea_configuration_data").attr ("value", configuration_data);
$("#textarea_configuration_data").val(configuration_data);
$("#component_loading").hide ();
$("#id_module_type option[value="+data["type"]+"]").select (1);
$("#text-max").attr ("value", data["max"]);
@ -119,7 +119,10 @@ function configure_modules_form () {
}
else {
period_select_update('module_interval', data["module_interval"]);
} $("#id_module_group option[value="+data["id_module_group"]+"]").select (1);
}
$("#id_module_group option[value="+data["id_module_group"]+"]").select (1);
if (data["history_data"])
$("#checkbox-history_data").check ();
else