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,6 +125,8 @@ 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();
if(!empty($agentGroups) && !empty($modelGroups)) {
array_walk($modelGroups, 'translate'); //Translate all head titles to language is set array_walk($modelGroups, 'translate'); //Translate all head titles to language is set
foreach ($modelGroups as $i => $n) { foreach ($modelGroups as $i => $n) {
@ -259,6 +261,10 @@ function mainModuleGroups() {
'</li>' . '</li>' .
"</ul>" . "</ul>" .
"</p>"; "</p>";
}
else {
echo "<div class='nf'>".__('There are no defined groups or module groups')."</div>";
}
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,23 +205,24 @@ 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)) {
$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 ();
$iterator = 0;
foreach ($groups as $id_group => $group) {
if ($group['deep'] == 0) { if ($group['deep'] == 0) {
$table->rowstyle[$iterator] = ''; $table->rowstyle[$iterator] = '';
} }
@ -307,9 +308,22 @@ foreach ($groups as $id_group => $group) {
array_push ($table->data, $data); array_push ($table->data, $data);
$iterator++; $iterator++;
}
html_print_table ($table);
}
else {
echo "<div class='nf'>".__('There are no defined groups')."</div>";
} }
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)) {
$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 ();
foreach ($groups as $id_group ) {
$data = array (); $data = array ();
$data[0] = $id_group["id_mg"]; $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[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>'; $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); array_push ($table->data, $data);
} }
html_print_table ($table); html_print_table ($table);
}
else{
echo "<div class='nf'>".__('There are no defined module groups')."</div>";
}
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,7 +126,12 @@ if ((isset ($_GET["form_add"])) || (isset ($_GET["form_edit"]))) {
echo '</form></td></tr></table>'; echo '</form></td></tr></table>';
} }
else { else {
$rows = db_get_all_rows_in_table("tnews", "timestamp");
if ($rows === false) {
$rows = array();
echo "<div class='nf'>".__('There are no defined news')."</div>";
}
else {
// Main list view for Links editor // Main list view for Links editor
echo "<table cellpadding='4' cellspacing='4' class='databox' width=98%>"; echo "<table cellpadding='4' cellspacing='4' class='databox' width=98%>";
echo "<th>".__('Subject')."</th>"; echo "<th>".__('Subject')."</th>";
@ -134,10 +139,7 @@ else {
echo "<th>".__('Timestamp')."</th>"; echo "<th>".__('Timestamp')."</th>";
echo "<th>".__('Delete')."</th>"; echo "<th>".__('Delete')."</th>";
$rows = db_get_all_rows_in_table("tnews", "timestamp");
if ($rows === false) {
$rows = array();
}
$color = 1; $color = 1;
foreach ($rows as $row) { foreach ($rows as $row) {
@ -157,6 +159,8 @@ else {
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 '<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">';
if(isset($data)) {
html_print_table ($table); 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'];