2011-07-21 Sergio Martin <sergio.martin@artica.es>

* include/functions_users.php
	extensions/module_groups.php
	godmode/groups/modu_group_list.php
	godmode/groups/group_list.php
	godmode/alerts/alert_commands.php
	godmode/setup/os.list.php
	godmode/setup/news.php
	godmode/users/profile_list.php
	godmode/modules/manage_network_components.php
	godmode/modules/manage_nc_groups.php: Fixed several lonely 
	headers when no data and other no data little bugs for 3371455



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4614 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2011-07-21 12:37:24 +00:00
parent e190fee36f
commit d5a0415def
11 changed files with 337 additions and 275 deletions

View File

@ -1,3 +1,17 @@
2011-07-21 Sergio Martin <sergio.martin@artica.es>
* include/functions_users.php
extensions/module_groups.php
godmode/groups/modu_group_list.php
godmode/groups/group_list.php
godmode/alerts/alert_commands.php
godmode/setup/os.list.php
godmode/setup/news.php
godmode/users/profile_list.php
godmode/modules/manage_network_components.php
godmode/modules/manage_nc_groups.php: Fixed several lonely
headers when no data and other no data little bugs for 3371455
2011-07-21 Ramon Novoa <rnovoa@artica.es> 2011-07-21 Ramon Novoa <rnovoa@artica.es>
* include/functions_config.php: Set dbtype to mysql by default * include/functions_config.php: Set dbtype to mysql by default

View File

@ -125,140 +125,146 @@ function mainModuleGroups() {
$agentGroups = users_get_groups ($config['id_user'], "AR", false); $agentGroups = users_get_groups ($config['id_user'], "AR", false);
$modelGroups = users_get_all_model_groups(); $modelGroups = users_get_all_model_groups();
array_walk($modelGroups, 'translate'); //Translate all head titles to language is set
foreach ($modelGroups as $i => $n) { if(!empty($agentGroups) && !empty($modelGroups)) {
$modelGroups[$i] = ui_print_truncate_text($n, 20); array_walk($modelGroups, 'translate'); //Translate all head titles to language is set
}
$head = $modelGroups; foreach ($modelGroups as $i => $n) {
array_unshift($head, '&nbsp;'); $modelGroups[$i] = ui_print_truncate_text($n, 20);
}
//Metaobject use in html_print_table
$table = null; $head = $modelGroups;
$table->align[0] = 'right'; //Align to right the first column. array_unshift($head, '&nbsp;');
$table->style[0] = 'color: #ffffff; background-color: #778866; font-weight: bolder;';
$table->head = $head;
$table->width = '95%';
//The content of table
$tableData = array();
$fired = false;
//Create rows and cells
foreach ($agentGroups as $idAgentGroup => $name) {
$row = array(); //Metaobject use in html_print_table
$table = null;
$table->align[0] = 'right'; //Align to right the first column.
$table->style[0] = 'color: #ffffff; background-color: #778866; font-weight: bolder;';
$table->head = $head;
$table->width = '95%';
array_push($row, ui_print_truncate_text($name, 20)); //The content of table
$tableData = array();
foreach ($modelGroups as $idModelGroup => $modelGroup) {
$query = sprintf($sql,$idAgentGroup, $idModelGroup); $fired = false;
//Create rows and cells
foreach ($agentGroups as $idAgentGroup => $name) {
$rowsDB = db_get_all_rows_sql ($query); $row = array();
array_push($row, ui_print_truncate_text($name, 20));
$agents = agents_get_group_agents($idAgentGroup);
foreach ($modelGroups as $idModelGroup => $modelGroup) {
if (!empty($agents)) { $query = sprintf($sql,$idAgentGroup, $idModelGroup);
$alerts = agents_get_alerts_simple($agents);
foreach ($alerts as $alert) { $rowsDB = db_get_all_rows_sql ($query);
$module = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module']));
$agents = agents_get_group_agents($idAgentGroup);
if (!empty($agents)) {
$alerts = agents_get_alerts_simple($agents);
if ($idModelGroup == $module['id_module_group']) { foreach ($alerts as $alert) {
if ($alert["times_fired"] > 0) { $module = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module']));
$fired = true;
if ($idModelGroup == $module['id_module_group']) {
if ($alert["times_fired"] > 0) {
$fired = true;
}
} }
} }
} }
}
$states = array();
if ($rowsDB !== false) {
foreach ($rowsDB as $rowDB) {
$states[$rowDB['estado']] = $rowDB['count'];
}
}
$count = 0;
foreach ($states as $idState => $state) {
$count += $state;
}
$color = 'transparent'; //Defaut color for cell
$font_color = '#000000'; //Default font color for cell
if ($count == 0) {
$color = '#eeeeee'; //Soft grey when the cell for this model group and agent group hasn't modules.
$alinkStart = '';
$alinkEnd = '';
}
else {
if ($fired) { $states = array();
$color = '#ffa300'; //Orange when the cell for this model group and agent has at least one alert fired. if ($rowsDB !== false) {
} foreach ($rowsDB as $rowDB) {
else if (array_key_exists(1,$states)) { $states[$rowDB['estado']] = $rowDB['count'];
$color = '#cc0000'; //Red when the cell for this model group and agent has at least one module in critical state and the rest in any state. }
$font_color = '#ffffff';
}
elseif (array_key_exists(2,$states)) {
$color = '#fce94f'; //Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
}
elseif (array_key_exists(3,$states)) {
$color = '#babdb6'; //Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
}
elseif (array_key_exists(0,$states)) {
$color = '#8ae234'; //Green when the cell for this model group and agent has OK state all modules.
} }
$count = 0;
foreach ($states as $idState => $state) {
$count += $state;
}
$alinkStart = '<a class="info_cell" rel="ajax.php?page=extensions/module_groups&get_info_alert_module_group=1&module_group=' . $idModelGroup . '&id_agent_group=' . $idAgentGroup . '" $color = 'transparent'; //Defaut color for cell
href="index.php?sec=estado&sec2=operation/agentes/status_monitor&status=-1&ag_group=' . $idAgentGroup . $font_color = '#000000'; //Default font color for cell
'&modulegroup=' . $idModelGroup . '" style="color: ' . $font_color . '; font-size: 18px;";>'; if ($count == 0) {
$alinkEnd = '</a>'; $color = '#eeeeee'; //Soft grey when the cell for this model group and agent group hasn't modules.
$alinkStart = '';
$alinkEnd = '';
}
else {
if ($fired) {
$color = '#ffa300'; //Orange when the cell for this model group and agent has at least one alert fired.
}
else if (array_key_exists(1,$states)) {
$color = '#cc0000'; //Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
$font_color = '#ffffff';
}
elseif (array_key_exists(2,$states)) {
$color = '#fce94f'; //Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
}
elseif (array_key_exists(3,$states)) {
$color = '#babdb6'; //Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
}
elseif (array_key_exists(0,$states)) {
$color = '#8ae234'; //Green when the cell for this model group and agent has OK state all modules.
}
$alinkStart = '<a class="info_cell" rel="ajax.php?page=extensions/module_groups&get_info_alert_module_group=1&module_group=' . $idModelGroup . '&id_agent_group=' . $idAgentGroup . '"
href="index.php?sec=estado&sec2=operation/agentes/status_monitor&status=-1&ag_group=' . $idAgentGroup .
'&modulegroup=' . $idModelGroup . '" style="color: ' . $font_color . '; font-size: 18px;";>';
$alinkEnd = '</a>';
}
array_push($row,
'<div
style="background: ' . $color . ';
height: 25px;
margin-left: auto; margin-right: auto;
text-align: center; padding-top: 0px; font-size: 18px;">
' . $alinkStart . $count . $alinkEnd . '</div>');
} }
array_push($tableData,$row);
array_push($row,
'<div
style="background: ' . $color . ';
height: 25px;
margin-left: auto; margin-right: auto;
text-align: center; padding-top: 0px; font-size: 18px;">
' . $alinkStart . $count . $alinkEnd . '</div>');
} }
array_push($tableData,$row); $table->data = $tableData;
echo "<div style='width:98%; overflow-x:scroll;'>";
html_print_table($table);
echo "</div>";
echo "<p>" . __("The colours meaning:") .
"<ul style='float: left;'>" .
'<li style="clear: both;">
<div style="float: left; background: #ffa300; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Orange cell when the module group and agent have at least one alarm fired.") .
'</li>' .
'<li style="clear: both;">
<div style="float: left; background: #cc0000; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Red cell when the module group and agent have at least one module in critical status and the others in any status") .
'</li>' .
'<li style="clear: both;">
<div style="float: left; background: #fce94f; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status") .
'</li>' .
'<li style="clear: both;">
<div style="float: left; background: #8ae234; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Green cell when the module group and agent have all modules in OK status") .
'</li>' .
'<li style="clear: both;">
<div style="float: left; background: #babdb6; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Grey cell when the module group and agent have at least one in unknown status and the others in green status") .
'</li>' .
"</ul>" .
"</p>";
}
else {
echo "<div class='nf'>".__('There are no defined groups or module groups')."</div>";
} }
$table->data = $tableData;
echo "<div style='width:98%; overflow-x:scroll;'>";
html_print_table($table);
echo "</div>";
echo "<p>" . __("The colours meaning:") .
"<ul style='float: left;'>" .
'<li style="clear: both;">
<div style="float: left; background: #ffa300; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Orange cell when the module group and agent have at least one alarm fired.") .
'</li>' .
'<li style="clear: both;">
<div style="float: left; background: #cc0000; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Red cell when the module group and agent have at least one module in critical status and the others in any status") .
'</li>' .
'<li style="clear: both;">
<div style="float: left; background: #fce94f; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status") .
'</li>' .
'<li style="clear: both;">
<div style="float: left; background: #8ae234; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Green cell when the module group and agent have all modules in OK status") .
'</li>' .
'<li style="clear: both;">
<div style="float: left; background: #babdb6; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Grey cell when the module group and agent have at least one in unknown status and the others in green status") .
'</li>' .
"</ul>" .
"</p>";
ui_require_css_file('cluetip'); ui_require_css_file('cluetip');
ui_require_jquery_file('cluetip'); ui_require_jquery_file('cluetip');

View File

@ -162,7 +162,12 @@ foreach ($commands as $command) {
array_push ($table->data, $data); array_push ($table->data, $data);
} }
html_print_table ($table); if(isset($data)) {
html_print_table ($table);
}
else {
echo "<div class='nf'>".__('No alert commands configured')."</div>";
}
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_command">'; echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_command">';

View File

@ -205,111 +205,125 @@ if ($delete_group) {
} }
$table->width = '98%';
$table->head = array ();
$table->head[0] = __('Name');
$table->head[1] = __('ID');
$table->head[2] = __('Icon');
$table->head[3] = __('Alerts');
$table->head[4] = __('Actions');
$table->align = array ();
$table->align[2] = 'center';
$table->align[4] = 'center';
$table->data = array ();
$groups = users_get_groups_tree ($config['id_user'], "AR", true); $groups = users_get_groups_tree ($config['id_user'], "AR", true);
$iterator = 0; $table->width = '98%';
foreach ($groups as $id_group => $group) { if(!empty($groups)) {
if ($group['deep'] == 0) { $table->head = array ();
$table->rowstyle[$iterator] = ''; $table->head[0] = __('Name');
} $table->head[1] = __('ID');
else { $table->head[2] = __('Icon');
if ($group['parent'] != 0) { $table->head[3] = __('Alerts');
$table->rowstyle[$iterator] = 'display: none;'; $table->head[4] = __('Actions');
$table->align = array ();
$table->align[2] = 'center';
$table->align[4] = 'center';
$table->data = array ();
$iterator = 0;
foreach ($groups as $id_group => $group) {
if ($group['deep'] == 0) {
$table->rowstyle[$iterator] = '';
} }
} else {
if ($group['parent'] != 0) {
$symbolBranchs = ''; $table->rowstyle[$iterator] = 'display: none;';
if ($group['id_grupo'] != 0) {
//Make a list of parents this group
$end = false;
$unloop = true;
$parents = null;
$parents[] = $group['parent'];
while (!$end) {
$lastParent = end($parents);
if ($lastParent == 0) {
$end = true;
} }
else { }
$unloop = true;
foreach ($groups as $id => $node) { $symbolBranchs = '';
if ($node['id_grupo'] == 0) { if ($group['id_grupo'] != 0) {
continue;
//Make a list of parents this group
$end = false;
$unloop = true;
$parents = null;
$parents[] = $group['parent'];
while (!$end) {
$lastParent = end($parents);
if ($lastParent == 0) {
$end = true;
}
else {
$unloop = true;
foreach ($groups as $id => $node) {
if ($node['id_grupo'] == 0) {
continue;
}
if ($node['id_grupo'] == $lastParent) {
array_push($parents, $node['parent']);
$unloop = false;
}
} }
if ($node['id_grupo'] == $lastParent) {
array_push($parents, $node['parent']); //For exit of infinite loop
$unloop = false; if ($unloop) {
break;
} }
} }
}
//For exit of infinite loop
if ($unloop) { $table->rowclass[$iterator] = 'parent_' . $group['parent'];
break;
//Print the branch classes (for close a branch with child branch in the
//javascript) of this parent as example:
//
// the tree (0(1,2(4,5),3))
// for the group 4 have the style "parent_4 branch_0 branch_2"
if (!empty($parents)) {
foreach ($parents as $idParent) {
$table->rowclass[$iterator] .= ' branch_' . $idParent;
$symbolBranchs .= ' symbol_branch_' . $idParent;
} }
} }
} }
$table->rowclass[$iterator] = 'parent_' . $group['parent']; $tabulation = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $group['deep']);
//Print the branch classes (for close a branch with child branch in the if ($group['id_grupo'] == 0) {
//javascript) of this parent as example: $symbol = '-';
//
// the tree (0(1,2(4,5),3))
// for the group 4 have the style "parent_4 branch_0 branch_2"
if (!empty($parents)) {
foreach ($parents as $idParent) {
$table->rowclass[$iterator] .= ' branch_' . $idParent;
$symbolBranchs .= ' symbol_branch_' . $idParent;
}
} }
else {
$symbol = '+';
}
if ($group['hash_branch']) {
$data[0] = '<strong>'.$tabulation . ' ' .
'<a href="javascript: showBranch(' . $group['id_grupo'] . ', ' . $group['parent'] . ');" title="' . __('Show branch children') . '"><span class="symbol_' . $group['id_grupo'] . ' ' . $symbolBranchs . '">' . $symbol . '</span> '. ui_print_truncate_text($group['nombre']).'</a></strong>';
}
else {
$data[0] = '<strong>'.$tabulation . ' '. ui_print_truncate_text($group['nombre'], 60).'</strong>';
}
$data[1] = $group['id_grupo'];
$data[2] = ui_print_group_icon($group['id_grupo'], true);
$data[3] = $group['disabled'] ? __('Disabled') : __('Enabled');
if ($group['id_grupo'] == 0) {
$data[4] = '';
}
else {
$data[4] = '<a href="index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group='.$group['id_grupo'].'">' . html_print_image("images/config.png", true, array("alt" => __('Edit'), "title" => __('Edit'), "border" => '0'));
$data[4] .= '&nbsp;&nbsp;<a href="index.php?sec=gagente&sec2=godmode/groups/group_list&id_group='.$id_group.'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">' . html_print_image("images/cross.png", true, array("alt" => __('Delete'), "border" => '0'));
}
array_push ($table->data, $data);
$iterator++;
} }
$tabulation = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $group['deep']); html_print_table ($table);
}
if ($group['id_grupo'] == 0) { else {
$symbol = '-'; echo "<div class='nf'>".__('There are no defined groups')."</div>";
}
else {
$symbol = '+';
}
if ($group['hash_branch']) {
$data[0] = '<strong>'.$tabulation . ' ' .
'<a href="javascript: showBranch(' . $group['id_grupo'] . ', ' . $group['parent'] . ');" title="' . __('Show branch children') . '"><span class="symbol_' . $group['id_grupo'] . ' ' . $symbolBranchs . '">' . $symbol . '</span> '. ui_print_truncate_text($group['nombre']).'</a></strong>';
}
else {
$data[0] = '<strong>'.$tabulation . ' '. ui_print_truncate_text($group['nombre'], 60).'</strong>';
}
$data[1] = $group['id_grupo'];
$data[2] = ui_print_group_icon($group['id_grupo'], true);
$data[3] = $group['disabled'] ? __('Disabled') : __('Enabled');
if ($group['id_grupo'] == 0) {
$data[4] = '';
}
else {
$data[4] = '<a href="index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group='.$group['id_grupo'].'">' . html_print_image("images/config.png", true, array("alt" => __('Edit'), "title" => __('Edit'), "border" => '0'));
$data[4] .= '&nbsp;&nbsp;<a href="index.php?sec=gagente&sec2=godmode/groups/group_list&id_group='.$id_group.'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">' . html_print_image("images/cross.png", true, array("alt" => __('Delete'), "border" => '0'));
}
array_push ($table->data, $data);
$iterator++;
} }
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/groups/configure_group">';
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button (__('Create group'), 'crt', false, 'class="sub next"');
echo '</div>';
echo '</form>';
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function showBranch(parent) { function showBranch(parent) {
display = $('.parent_' + parent).css('display'); display = $('.parent_' + parent).css('display');
@ -328,14 +342,3 @@ function showBranch(parent) {
} }
} }
</script> </script>
<?php
html_print_table ($table);
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/groups/configure_group">';
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button (__('Create group'), 'crt', false, 'class="sub next"');
echo '</div>';
echo '</form>';
?>

View File

@ -129,31 +129,36 @@ if ($delete_group) {
echo "<h3 class='suc'>".__('Group successfully deleted')."</h3>"; echo "<h3 class='suc'>".__('Group successfully deleted')."</h3>";
} }
$table->width = '98%';
$table->head = array ();
$table->head[0] = __('ID');
$table->head[1] = __('Name');
$table->head[2] = __('Delete');
$table->align = array ();
$table->align[1] = 'left';
$table->align[2] = 'center';
$table->data = array ();
$sql = "SELECT * $sql = "SELECT *
FROM tmodule_group "; FROM tmodule_group ";
$groups = db_get_all_rows_sql ($sql, true); $groups = db_get_all_rows_sql ($sql, true);
$table->width = '98%';
foreach ($groups as $id_group ) { if(!empty($groups)) {
$data = array (); $table->head = array ();
$data[0] = $id_group["id_mg"]; $table->head[0] = __('ID');
$data[1] = '<strong><a href="index.php?sec=gagente&sec2=godmode/groups/configure_modu_group&id_group='.$id_group["id_mg"].'">' . ui_print_truncate_text($id_group["name"], 50).'</a></strong>'; $table->head[1] = __('Name');
$data[2] = '<a href="index.php?sec=gagente&sec2=godmode/groups/modu_group_list&id_group='.$id_group["id_mg"].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a>'; $table->head[2] = __('Delete');
$table->align = array ();
array_push ($table->data, $data); $table->align[1] = 'left';
$table->align[2] = 'center';
$table->data = array ();
foreach ($groups as $id_group ) {
$data = array ();
$data[0] = $id_group["id_mg"];
$data[1] = '<strong><a href="index.php?sec=gagente&sec2=godmode/groups/configure_modu_group&id_group='.$id_group["id_mg"].'">' . ui_print_truncate_text($id_group["name"], 50).'</a></strong>';
$data[2] = '<a href="index.php?sec=gagente&sec2=godmode/groups/modu_group_list&id_group='.$id_group["id_mg"].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a>';
array_push ($table->data, $data);
}
html_print_table ($table);
}
else{
echo "<div class='nf'>".__('There are no defined module groups')."</div>";
} }
html_print_table ($table);
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/groups/configure_modu_group">'; echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/groups/configure_modu_group">';
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';

View File

@ -85,6 +85,14 @@ $url = ui_get_url_refresh (array ('offset' => false,
'upd' => false, 'upd' => false,
'id_sg' => false)); 'id_sg' => false));
$filter = array ();
$filter['offset'] = (int) get_parameter ('offset');
$filter['limit'] = (int) $config['block_size'];
$groups = db_get_all_rows_filter ('tnetwork_component_group', $filter);
if ($groups === false)
$groups = array ();
$table->width = '98%'; $table->width = '98%';
$table->head = array (); $table->head = array ();
$table->head[0] = __('Name'); $table->head[0] = __('Name');
@ -103,14 +111,6 @@ $table->data = array ();
$total_groups = db_get_all_rows_filter ('tnetwork_component_group', false, 'COUNT(*) AS total'); $total_groups = db_get_all_rows_filter ('tnetwork_component_group', false, 'COUNT(*) AS total');
$total_groups = $total_groups[0]['total']; $total_groups = $total_groups[0]['total'];
$filter = array ();
$filter['offset'] = (int) get_parameter ('offset');
$filter['limit'] = (int) $config['block_size'];
$groups = db_get_all_rows_filter ('tnetwork_component_group', $filter);
if ($groups === false)
$groups = array ();
ui_pagination ($total_groups, $url); ui_pagination ($total_groups, $url);
foreach ($groups as $group) { foreach ($groups as $group) {
@ -130,7 +130,13 @@ foreach ($groups as $group) {
array_push ($table->data, $data); array_push ($table->data, $data);
} }
html_print_table ($table); if(isset($data)) {
html_print_table ($table);
}
else {
echo "<div class='nf'>".__('There are no defined component groups')."</div>";
}
echo '<form method="post">'; echo '<form method="post">';
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';

View File

@ -299,6 +299,7 @@ if ($components === false)
$components = array (); $components = array ();
unset ($table); unset ($table);
$table->width = '98%'; $table->width = '98%';
$table->head = array (); $table->head = array ();
$table->head[0] = __('Module name'); $table->head[0] = __('Module name');
@ -340,7 +341,13 @@ foreach ($components as $component) {
array_push ($table->data, $data); array_push ($table->data, $data);
} }
html_print_table ($table); if(isset($data)) {
html_print_table ($table);
}
else {
echo "<div class='nf'>".__('There are no defined network components')."</div>";
}
echo '<form method="post" action="'.$url.'">'; echo '<form method="post" action="'.$url.'">';
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
@ -349,7 +356,7 @@ html_print_select (array (2 => __('Create a new network component'),
4 => __('Create a new plugin component'), 4 => __('Create a new plugin component'),
6 => __('Create a new WMI component')), 6 => __('Create a new WMI component')),
'id_component_type', '', '', '', '', ''); 'id_component_type', '', '', '', '', '');
html_print_submit_button (__('Create'), 'crt', false, 'class="sub next"'); html_print_submit_button (__('Create'), 'crt', false, 'class="sub next" style="margin-left: 5px;"');
echo '</div>'; echo '</div>';
echo '</form>' echo '</form>'
?> ?>

View File

@ -126,37 +126,41 @@ if ((isset ($_GET["form_add"])) || (isset ($_GET["form_edit"]))) {
echo '</form></td></tr></table>'; echo '</form></td></tr></table>';
} }
else { else {
// Main list view for Links editor
echo "<table cellpadding='4' cellspacing='4' class='databox' width=98%>";
echo "<th>".__('Subject')."</th>";
echo "<th>".__('Author')."</th>";
echo "<th>".__('Timestamp')."</th>";
echo "<th>".__('Delete')."</th>";
$rows = db_get_all_rows_in_table("tnews", "timestamp"); $rows = db_get_all_rows_in_table("tnews", "timestamp");
if ($rows === false) { if ($rows === false) {
$rows = array(); $rows = array();
echo "<div class='nf'>".__('There are no defined news')."</div>";
} }
else {
$color = 1; // Main list view for Links editor
foreach ($rows as $row) { echo "<table cellpadding='4' cellspacing='4' class='databox' width=98%>";
if ($color == 1) { echo "<th>".__('Subject')."</th>";
$tdcolor = "datos"; echo "<th>".__('Author')."</th>";
$color = 0; echo "<th>".__('Timestamp')."</th>";
} echo "<th>".__('Delete')."</th>";
else {
$tdcolor = "datos2";
$color = 1;
}
echo "<tr><td class='$tdcolor'><b><a href='index.php?sec=gsetup&sec2=godmode/setup/news&form_edit=1&id_news=".$row["id_news"]."'>".$row["subject"]."</a></b></td>";
echo "<td class='$tdcolor'>".$row["author"]."</b></td>";
echo "<td class='$tdcolor'>".$row["timestamp"]."</b></td>";
echo '<td class="'.$tdcolor.'" align="center"><a href="index.php?sec=gsetup&sec2=godmode/setup/news&id_news='.$row["id_news"].'&borrar='.$row["id_news"].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a></td></tr>';
$color = 1;
foreach ($rows as $row) {
if ($color == 1) {
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
}
echo "<tr><td class='$tdcolor'><b><a href='index.php?sec=gsetup&sec2=godmode/setup/news&form_edit=1&id_news=".$row["id_news"]."'>".$row["subject"]."</a></b></td>";
echo "<td class='$tdcolor'>".$row["author"]."</b></td>";
echo "<td class='$tdcolor'>".$row["timestamp"]."</b></td>";
echo '<td class="'.$tdcolor.'" align="center"><a href="index.php?sec=gsetup&sec2=godmode/setup/news&id_news='.$row["id_news"].'&borrar='.$row["id_news"].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a></td></tr>';
}
echo "</table>";
} }
echo "</table>";
echo "<table width='98%'>"; echo "<table width='98%'>";
echo "<tr><td align='right'>"; echo "<tr><td align='right'>";
echo "<form method='post' action='index.php?sec=gsetup&sec2=godmode/setup/news&form_add=1'>"; echo "<form method='post' action='index.php?sec=gsetup&sec2=godmode/setup/news&form_add=1'>";

View File

@ -60,5 +60,10 @@ foreach ($osList as $os) {
$table->data[] = $data; $table->data[] = $data;
} }
html_print_table($table); if(isset($data)) {
html_print_table($table);
}
else {
echo "<div class='nf'>".__('There are no defined operating systems')."</div>";
}
?> ?>

View File

@ -99,7 +99,12 @@ foreach ($profiles as $profile) {
} }
echo '<form method="post" action="index.php?sec=gusuarios&sec2=godmode/users/configure_profile">'; echo '<form method="post" action="index.php?sec=gusuarios&sec2=godmode/users/configure_profile">';
html_print_table ($table); if(isset($data)) {
html_print_table ($table);
}
else {
echo "<div class='nf'>".__('There are no defined profiles')."</div>";
}
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_input_hidden ('new_profile', 1); html_print_input_hidden ('new_profile', 1);
html_print_submit_button (__('Create'), "crt", false, 'class="sub next"'); html_print_submit_button (__('Create'), "crt", false, 'class="sub next"');

View File

@ -48,7 +48,9 @@ function users_get_info ($order = "fullname", $info = "fullname") {
*/ */
function users_get_all_model_groups () { function users_get_all_model_groups () {
$groups = db_get_all_rows_in_table ('tmodule_group'); $groups = db_get_all_rows_in_table ('tmodule_group');
if($groups === false) {
$groups = array();
}
$returnGroups = array(); $returnGroups = array();
foreach ($groups as $group) foreach ($groups as $group)
$returnGroups[$group['id_mg']] = $group['name']; $returnGroups[$group['id_mg']] = $group['name'];