2013-06-05 Miguel de Dios <miguel.dedios@artica.es>

* operation/snmpconsole/snmp_view.php: fixed the pagination.
	
	Fixes: #2255
	
	* godmode/groups/group_list.php, godmode/agentes/agent_manager.php:
	cleaned source code style.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8256 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-06-05 12:13:29 +00:00
parent d7452b385d
commit ef22794ecd
4 changed files with 74 additions and 24 deletions

View File

@ -1,3 +1,12 @@
2013-06-05 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php: fixed the pagination.
Fixes: #2255
* godmode/groups/group_list.php, godmode/agentes/agent_manager.php:
cleaned source code style.
2013-06-04 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/agent_manager.php, godmode/menu.php,

View File

@ -243,14 +243,19 @@ $table->data[0][0] = __('Custom ID');
$table->data[0][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, true);
// Learn mode / Normal mode
$table->data[1][0] = __('Module definition').ui_print_help_icon("module_definition", true);
$table->data[1][1] = __('Learning mode').' '.html_print_radio_button_extended ("modo", 1, '', $modo, false, '', 'style="margin-right: 40px;"', true);
$table->data[1][1] .= __('Normal mode').' '.html_print_radio_button_extended ("modo", 0, '', $modo, false, '', 'style="margin-right: 40px;"', true);
$table->data[1][0] = __('Module definition') .
ui_print_help_icon("module_definition", true);
$table->data[1][1] = __('Learning mode') . ' ' .
html_print_radio_button_extended ("modo", 1, '', $modo, false, '', 'style="margin-right: 40px;"', true);
$table->data[1][1] .= __('Normal mode') . ' ' .
html_print_radio_button_extended ("modo", 0, '', $modo, false, '', 'style="margin-right: 40px;"', true);
// Status (Disabled / Enabled)
$table->data[2][0] = __('Status');
$table->data[2][1] = __('Disabled').' '.html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
$table->data[2][1] .= __('Active').' '.html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
$table->data[2][1] = __('Disabled') . ' ' .
html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
$table->data[2][1] .= __('Active') . ' ' .
html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
// Remote configuration
$table->data[3][0] = __('Remote configuration');
@ -261,7 +266,8 @@ if (!$new_agent) {
// Delete remote configuration
$table->data[3][1] .= '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=main&amp;disk_conf_delete=1&amp;id_agente='.$id_agente.'">';
$table->data[3][1] .= html_print_image ("images/cross.png", true, array ('title' => __('Delete remote configuration file'), 'style' => 'vertical-align: middle;')).'</a>';
$table->data[3][1] .= '</a>'.ui_print_help_tip (__('Delete this conf file implies that for restore you must reactive remote config in the local agent.'), true);
$table->data[3][1] .= '</a>' .
ui_print_help_tip (__('Delete this conf file implies that for restore you must reactive remote config in the local agent.'), true);
}
else
$table->data[3][1] = '<em>' . __('Not available') . '</em>';
@ -354,7 +360,7 @@ if (!empty($fields)) {
ui_toggle(html_print_table ($table, true), __('Custom fields'));
}
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<div class="action-buttons" style="width: ' . $table->width . '">';
if ($id_agente) {
html_print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"');
html_print_input_hidden ('update_agent', 1);

View File

@ -188,7 +188,7 @@ if ($update_group) {
$other = (string) get_parameter ('other');
/*Check if name field is empty*/
if( $name != "") {
if ( $name != "") {
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ('UPDATE tgrupo SET nombre = "%s",

View File

@ -59,7 +59,7 @@ ui_print_page_header (__("SNMP Console"), "images/op_snmp.png", false, "", false
// OPERATIONS
// Delete SNMP Trap entry Event (only incident management access).
if (isset ($_GET["delete"])){
if (isset ($_GET["delete"])) {
$id_trap = (int) get_parameter_get ("delete", 0);
if ($id_trap > 0 && check_acl ($config['id_user'], 0, "IM")) {
@ -124,17 +124,28 @@ if (isset ($_POST["updatebt"])) {
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ("SELECT * FROM ttrap ORDER BY timestamp DESC LIMIT %d,%d",$offset,$pagination);
$sql = sprintf ("
SELECT *
FROM ttrap
ORDER BY timestamp DESC
LIMIT %d,%d",$offset,$pagination);
break;
case "postgresql":
$sql = sprintf ("SELECT * FROM ttrap ORDER BY timestamp DESC LIMIT %d OFFSET %d", $pagination, $offset);
$sql = sprintf ("
SELECT *
FROM ttrap
ORDER BY timestamp DESC
LIMIT %d OFFSET %d", $pagination, $offset);
break;
case "oracle":
$set = array();
$set['limit'] = $pagination;
$set['offset'] = $offset;
$sql = sprintf ("SELECT * FROM ttrap ORDER BY timestamp DESC");
$sql = oracle_recode_query ($sql, $set);
$sql = sprintf ("
SELECT *
FROM ttrap
ORDER BY timestamp DESC");
$sql = oracle_recode_query ($sql, $set);
break;
}
$traps = db_get_all_rows_sql ($sql);
@ -143,7 +154,7 @@ $all_traps = db_get_all_rows_sql ("SELECT * FROM ttrap");
if (($config['dbtype'] == 'oracle') && ($traps !== false)) {
for ($i=0; $i < count($traps); $i++) {
unset($traps[$i]['rnum']);
unset($traps[$i]['rnum']);
}
}
@ -176,13 +187,24 @@ foreach ($all_traps as $trap) {
//Make query to extract traps of DB.
switch ($config["dbtype"]) {
case "mysql":
$sql = "SELECT * FROM ttrap %s ORDER BY timestamp DESC LIMIT %d,%d";
$sql = "
SELECT *
FROM ttrap %s
ORDER BY timestamp DESC
LIMIT %d,%d";
break;
case "postgresql":
$sql = "SELECT * FROM ttrap %s ORDER BY timestamp DESC LIMIT %d OFFSET %d";
$sql = "
SELECT *
FROM ttrap %s
ORDER BY timestamp DESC
LIMIT %d OFFSET %d";
break;
case "oracle":
$sql = "SELECT * FROM ttrap %s ORDER BY timestamp DESC";
$sql = "
SELECT *
FROM ttrap %s
ORDER BY timestamp DESC";
break;
}
$whereSubquery = 'WHERE 1=1';
@ -297,7 +319,7 @@ switch ($config["dbtype"]) {
$set = array();
$set['limit'] = $pagination;
$set['offset'] = $offset;
$sql = oracle_recode_query ($sql, $set);
$sql = oracle_recode_query ($sql, $set);
break;
}
@ -305,7 +327,7 @@ $traps = db_get_all_rows_sql($sql);
if (($config['dbtype'] == 'oracle') && ($traps !== false)) {
for ($i=0; $i < count($traps); $i++) {
unset($traps[$i]['rnum']);
unset($traps[$i]['rnum']);
}
}
@ -366,12 +388,25 @@ ui_toggle($filter, __('Toggle filter(s)'));
unset ($table);
// Prepare index for pagination
$trapcount = db_get_sql ("SELECT COUNT(id_trap) FROM ttrap " . $whereSubquery);
$trapcount = db_get_sql ("
SELECT COUNT(id_trap)
FROM ttrap " .
$whereSubquery);
$urlPagination = "index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&filter_agent=" . $filter_agent
. "&filter_oid=" . $filter_oid . "&filter_severity=" . $filter_severity
. "&filter_fired=" . $filter_fired . "&filter_status=" . $filter_status
. "&search_string=" . $search_string . "&pagination=".$pagination."&offset=".$offset."&refr=".((int)get_parameter('refr', 0))."&pure=".$config["pure"];
$urlPagination = "index.php?" .
"sec=estado&" .
"sec2=operation/snmpconsole/snmp_view&" .
"filter_agent=" . $filter_agent . "&" .
"filter_oid=" . $filter_oid . "&" .
"filter_severity=" . $filter_severity . "&" .
"filter_fired=" . $filter_fired . "&" .
"filter_status=" . $filter_status . "&" .
"search_string=" . $search_string . "&" .
"pagination=" . $pagination . "&" .
"offset=" . $offset . "&" .
"refr=" . ((int)get_parameter('refr', 0)) . "&" .
"pure=" . $config["pure"] . "&" .
"search_string=" . $search_string;
ui_pagination ($trapcount, $urlPagination, $offset, $pagination);
echo '<form name="eventtable" method="POST" action="index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&pagination='.$pagination.'&offset='.$offset.'">';