2013-04-25 Miguel de Dios <miguel.dedios@artica.es>

* extensions/agents_modules.php: changed the header of the table
	agents modules, now it uses css3 (and some tricks in javascript)
	and the text for the modules is vertical.
	
	Fixes: #3539424
	
	* operation/integria_incidents/incident.list.php,
	operation/search_users.getdata.php,
	godmode/servers/manage_recontask_form.php,
	godmode/massive/massive_delete_action_alerts.php,
	godmode/modules/manage_network_components_form.php: improved the
	source code style.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8059 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-04-25 15:34:53 +00:00
parent d9999cd12b
commit ffb7ad00cc
7 changed files with 91 additions and 25 deletions

View File

@ -1,3 +1,18 @@
2013-04-25 Miguel de Dios <miguel.dedios@artica.es>
* extensions/agents_modules.php: changed the header of the table
agents modules, now it uses css3 (and some tricks in javascript)
and the text for the modules is vertical.
Fixes: #3539424
* operation/integria_incidents/incident.list.php,
operation/search_users.getdata.php,
godmode/servers/manage_recontask_form.php,
godmode/massive/massive_delete_action_alerts.php,
godmode/modules/manage_network_components_form.php: improved the
source code style.
2013-04-25 Ramon Novoa <rnovoa@artica.es> 2013-04-25 Ramon Novoa <rnovoa@artica.es>
* images/cross_double.png, * images/cross_double.png,

View File

@ -85,12 +85,14 @@ function mainAgentsModules() {
$comborefr = '<form method="post" action="' . ui_get_url_refresh (array ('offset' => 0, 'hor_offset' => 0)).'">'; $comborefr = '<form method="post" action="' . ui_get_url_refresh (array ('offset' => 0, 'hor_offset' => 0)).'">';
$comborefr .= '<b>'.__('Refresh').'</b>'; $comborefr .= '<b>'.__('Refresh').'</b>';
$comborefr .= html_print_select ( $comborefr .= html_print_select (
array('30' => '30 '.__('seconds'), array('30' => '30 ' . __('seconds'),
(string)SECONDS_1MINUTE => __('1 minute'), (string)SECONDS_1MINUTE => __('1 minute'),
(string)SECONDS_2MINUTES => __('2 minutes'), (string)SECONDS_2MINUTES => __('2 minutes'),
(string)SECONDS_5MINUTES => __('5 minutes'), (string)SECONDS_5MINUTES => __('5 minutes'),
(string)SECONDS_10MINUTES => __('10 minutes')), (string)SECONDS_10MINUTES => __('10 minutes')),
'refr', (int)get_parameter('refr', 0), $script = 'this.form.submit()', '', 0, true, false, false, '', false, 'width: 100px; margin-right: 10px; margin-top: 5px;'); 'refr', (int)get_parameter('refr', 0),
$script = 'this.form.submit()', '', 0, true, false, false, '',
false, 'width: 100px; margin-right: 10px; margin-top: 5px;');
$comborefr .= "</form>"; $comborefr .= "</form>";
if ($config["pure"] == 0) { if ($config["pure"] == 0) {
@ -137,8 +139,8 @@ function mainAgentsModules() {
$name = ''; $name = '';
$cont = 0; $cont = 0;
foreach($all_modules as $key => $module) { foreach ($all_modules as $key => $module) {
if($module == $name) { if ($module == $name) {
$modules_by_name[$cont-1]['id'][] = $key; $modules_by_name[$cont-1]['id'][] = $key;
} }
else { else {
@ -149,32 +151,35 @@ function mainAgentsModules() {
} }
} }
if($config["pure"] == 1) { if ($config["pure"] == 1) {
$block = count($modules_by_name); $block = count($modules_by_name);
} }
$filter_groups = array ('offset' => (int) $offset, $filter_groups = array ('offset' => (int) $offset,
'limit' => (int) $config['block_size']); 'limit' => (int) $config['block_size']);
if($group_id > 0) { if ($group_id > 0) {
$filter_groups['id_grupo'] = $group_id; $filter_groups['id_grupo'] = $group_id;
} }
$agents = agents_get_agents ($filter_groups); $agents = agents_get_agents ($filter_groups);
$nagents = count($agents); $nagents = count($agents);
if($all_modules == false || $agents == false) { if ($all_modules == false || $agents == false) {
echo "<div class='nf'>".__('There are no agents with modules')."</div>"; echo "<div class='nf'>".__('There are no agents with modules')."</div>";
return; return;
} }
echo '<table cellpadding="4" cellspacing="4" border="0" width=98%>'; echo '<table cellpadding="4" cellspacing="4" border="0">';
echo "<th width='140px' height='25px'>".__("Agents")." / ".__("Modules")."</th>"; echo "<tr>";
if($hor_offset > 0) { echo "<th width='140px' height='25px' valign='bottom' style='text-align: right !important;'>" . __("Agents") . " / " . __("Modules") . "</th>";
if ($hor_offset > 0) {
$new_hor_offset = $hor_offset-$block; $new_hor_offset = $hor_offset-$block;
echo "<th width='20px' style='vertical-align:top; padding-top: 35px;' rowspan='".($nagents+1)."'><a href='index.php?sec=extensions&sec2=extensions/agents_modules&refr=0&hor_offset=".$new_hor_offset."&offset=".$offset."&group_id=".$group_id."&modulegroup=".$modulegroup."'>".html_print_image("images/darrowleft.png",true, array('title' => __('Previous modules')))."</a> </th>"; echo "<th width='20px' style='vertical-align:top; padding-top: 35px;' rowspan='" . ($nagents + 1) . "'>" .
"<a href='index.php?sec=extensions&sec2=extensions/agents_modules&refr=0&hor_offset=" . $new_hor_offset . "&offset=".$offset."&group_id=".$group_id."&modulegroup=".$modulegroup."'>".html_print_image("images/darrowleft.png",true, array('title' => __('Previous modules')))."</a> </th>";
} }
$nmodules = 0; $nmodules = 0;
foreach ($modules_by_name as $module) { foreach ($modules_by_name as $module) {
@ -184,16 +189,26 @@ function mainAgentsModules() {
continue; continue;
} }
echo '<th width="20px" >'. html_print_image('images/information.png', true, array('title' => io_safe_output($module['name']))) ."</th>"; $text = ui_print_truncate_text(io_safe_output($module['name']), 'module_small');
echo '<th align="center" width="20px" id="th_module_r_' . $nmodules . '" class="th_class_module_r">
<div style="width: 30px;">
<div id="div_module_r_' . $nmodules . '" style="display: none;" class="rotate_text_module">' .
$text .
'</div>
</div>
</th>';
} }
if(($hor_offset + $block) < $nmodules) { if (($hor_offset + $block) < $nmodules) {
$new_hor_offset = $hor_offset+$block; $new_hor_offset = $hor_offset+$block;
echo "<th width='20px' style='vertical-align:top; padding-top: 35px;' rowspan='".($nagents+1)."'><a href='index.php?sec=extensions&sec2=extensions/agents_modules&hor_offset=".$new_hor_offset."&offset=".$offset."&group_id=".$group_id."&modulegroup=".$modulegroup."'>".html_print_image("images/darrowright.png",true, array('title' => __('More modules')))."</a> </th>"; echo "<th width='20px' style='vertical-align:top; padding-top: 35px;' rowspan='".($nagents+1)."'><a href='index.php?sec=extensions&sec2=extensions/agents_modules&hor_offset=".$new_hor_offset."&offset=".$offset."&group_id=".$group_id."&modulegroup=".$modulegroup."'>".html_print_image("images/darrowright.png",true, array('title' => __('More modules')))."</a> </th>";
} }
echo "</tr>";
$filter_agents = false; $filter_agents = false;
if($group_id > 0) { if ($group_id > 0) {
$filter_agents = array('id_grupo' => $group_id); $filter_agents = array('id_grupo' => $group_id);
} }
// Prepare pagination // Prepare pagination
@ -307,6 +322,42 @@ function mainAgentsModules() {
'</li>' . '</li>' .
"</ul>" . "</ul>" .
"</p>"; "</p>";
echo "
<style type='text/css'>
.rotate_text_module {
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-o-transform: rotate(270deg);
writing-mode: lr-tb;
white-space: nowrap;
}
</style>
<script type='text/javascript'>
$(document).ready(function () {
//Get max width of name of modules
max_width = 0;
$.each($('.th_class_module_r'), function (i, elem) {
id = $(elem).attr('id').replace('th_module_r_', '');
width = $(\"#div_module_r_\" + id).width();
if (max_width < width) {
max_width = width;
}
});
$.each($('.th_class_module_r'), function (i, elem) {
id = $(elem).attr('id').replace('th_module_r_', '');
$(\"#th_module_r_\" + id).height(($(\"#div_module_r_\" + id).width() + 10) + 'px');
console.log($(\"#div_module_r_\" + id).width());
//$(\"#div_module_r_\" + id).css('margin-top', (max_width - $(\"#div_module_r_\" + id).width()) + 'px');
$(\"#div_module_r_\" + id).css('margin-top', (max_width - 20) + 'px');
$(\"#div_module_r_\" + id).show();
});
});
</script>
";
} }
extensions_add_operation_menu_option(__("Agents/Modules view"), 'estado', 'agents_modules/icon_menu.png', "v1r1"); extensions_add_operation_menu_option(__("Agents/Modules view"), 'estado', 'agents_modules/icon_menu.png', "v1r1");

View File

@ -61,7 +61,7 @@ if ($delete) {
$agent_alerts = agents_get_alerts($id_agents); $agent_alerts = agents_get_alerts($id_agents);
$alerts_agent_modules = array(); $alerts_agent_modules = array();
foreach ($agent_alerts['simple'] as $agent_alert){ foreach ($agent_alerts['simple'] as $agent_alert) {
if (in_array($agent_alert['id_alert_template'], $id_alert_templates)) { if (in_array($agent_alert['id_alert_template'], $id_alert_templates)) {
$alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module ($agent_alert['id_agent_module'], true, false, 'id')); $alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module ($agent_alert['id_agent_module'], true, false, 'id'));
} }
@ -192,7 +192,7 @@ $(document).ready (function () {
update_alerts(); update_alerts();
var recursion; var recursion;
$("#checkbox-recursion").click(function (){ $("#checkbox-recursion").click(function () {
recursion = this.checked ? 1 : 0; recursion = this.checked ? 1 : 0;
$("#id_group").trigger("change"); $("#id_group").trigger("change");
}); });

View File

@ -413,12 +413,12 @@ $(document).ready (function () {
}); });
}); });
$("#submit-crt").click(function () { $("#submit-crt").click(function () {
$('#id_tag_selected option').map(function(){ $('#id_tag_selected option').map(function() {
$(this).attr('selected','selected'); $(this).attr('selected','selected');
}); });
}); });
$("#submit-upd").click(function () { $("#submit-upd").click(function () {
$('#id_tag_selected option').map(function(){ $('#id_tag_selected option').map(function() {
$(this).attr('selected','selected'); $(this).attr('selected','selected');
}); });
}); });

View File

@ -54,8 +54,8 @@ if (isset ($_GET["update"]) or (isset($_GET["crt"]))) { // Edit mode
} }
} }
if ($update_recon){ if ($update_recon) {
if (!isset($id_rt)){ if (!isset($id_rt)) {
$id_rt = (int) get_parameter_get ("update"); $id_rt = (int) get_parameter_get ("update");
} }
$row = db_get_row ("trecon_task","id_rt",$id_rt); $row = db_get_row ("trecon_task","id_rt",$id_rt);

View File

@ -41,8 +41,8 @@ if (isset ($result_groups['group'])) {
$resolutions[0] = __('None'); $resolutions[0] = __('None');
if (isset ($result_resolutions['resolution'])){ if (isset ($result_resolutions['resolution'])) {
foreach($result_resolutions['resolution'] as $res) { foreach ($result_resolutions['resolution'] as $res) {
$resolutions[$res['id']] = $res['name']; $resolutions[$res['id']] = $res['name'];
} }
} }

View File

@ -134,10 +134,10 @@ if ($searchUsers) {
LIMIT " . $config['block_size'] . " OFFSET " . get_parameter ('offset',0); LIMIT " . $config['block_size'] . " OFFSET " . get_parameter ('offset',0);
$users = db_process_sql($sql); $users = db_process_sql($sql);
if($users !== false) { if ($users !== false) {
//Check ACLs //Check ACLs
$users_id = array(); $users_id = array();
foreach($users as $key => $user){ foreach ($users as $key => $user) {
if (!check_acl ($config["id_user"], users_get_groups ($user["id_user"]), "UM") && $config["id_user"] != $user["id_user"]) { if (!check_acl ($config["id_user"], users_get_groups ($user["id_user"]), "UM") && $config["id_user"] != $user["id_user"]) {
unset($users[$key]); unset($users[$key]);
} }