diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 2f1ef08f1d..1b10a6e1f8 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2010-03-12 Sancho Lerena + + * godmode/groups/modu_group_list.php, + godmode/groups/configure_modu_group.php: New module group + editor/manager. Contributed by Antonio Dos Santos, thanks Antonio! + + * godmode/menu.php: Added modulegroup to menu. + 2010-03-12 Junichi Satoh * godmode/alerts/configure_alert_compound.php : Changed not to use diff --git a/pandora_console/godmode/groups/configure_modu_group.php b/pandora_console/godmode/groups/configure_modu_group.php new file mode 100644 index 0000000000..e1aa97100e --- /dev/null +++ b/pandora_console/godmode/groups/configure_modu_group.php @@ -0,0 +1,74 @@ +".__('There was a problem loading group').""; + echo ""; + include ("general/footer.php"); + exit; + } +} + + +$table->width = '450px'; +$table->data = array (); +$table->data[0][0] = __('Name'); +$table->data[0][1] = print_input_text ('name', $name, '', 35, 100, true); + + +echo''; +echo '
'; +print_table ($table); +echo '
'; +if ($id_group) { + print_input_hidden ('update_group', 1); + print_input_hidden ('id_group', $id_group); + print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"'); +} else { + print_input_hidden ('create_group', 1); + print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"'); +} +echo '
'; +echo '
'; +?> + diff --git a/pandora_console/godmode/groups/modu_group_list.php b/pandora_console/godmode/groups/modu_group_list.php new file mode 100644 index 0000000000..a8d9ffa94c --- /dev/null +++ b/pandora_console/godmode/groups/modu_group_list.php @@ -0,0 +1,149 @@ +".__('Group successfully created').""; + } else { + echo "

".__('There was a problem creating group')."

"; } +} + +/* Update group */ +if ($update_group) { + $id_group = (int) get_parameter ('id_group'); + $name = (string) get_parameter ('name'); + $icon = (string) get_parameter ('icon'); + $id_parent = (int) get_parameter ('id_parent'); + $alerts_enabled = (bool) get_parameter ('alerts_enabled'); + $custom_id = (string) get_parameter ('custom_id'); + + $sql = sprintf ('UPDATE tmodule_group SET name = "%s" WHERE id_mg = %d', $name,$id_group); + $result = process_sql ($sql); + if ($result !== false) { + echo "

".__('Group successfully updated')."

"; + } else { + echo "

".__('There was a problem modifying group')."

"; + } +} + +/* Delete group */ +if ($delete_group) { + $id_group = (int) get_parameter ('id_group'); + +// $sql = sprintf ('UPDATE tmodule_group set id_mg = 1 WHERE id_mg = %d', $id_group); +// $result = mysql_query ($sql); + $sql = sprintf ('DELETE FROM tmodule_group WHERE id_mg = %d', $id_group); + $result = mysql_query ($sql); + if (! $result) + echo "

".__('There was a problem deleting group')."

"; + else + echo "

".__('Group successfully deleted')."

"; +} + +$table->width = '65%'; +$table->head = array (); +$table->head[0] = __('Name'); +$table->head[1] = __('Delete'); +$table->align = array (); +$table->align[1] = 'center'; +$table->data = array (); + +//$groups = get_user_groups ($config['id_user']); + +$sql = "SELECT * + FROM tmodule_group "; +$groups = get_db_all_rows_sql ($sql, true); + + +foreach ($groups as $id_group ) { + $data = array (); + +// $group = get_db_row ('tmodule_group', 'id_mg', $id_group); + +// if (!empty ($group["icon"])) +// $data[0] = ''; +// else +// $data[0] = ' '; + $data[0] = ''.$id_group["name"].''; +// $data[2] = get_group_name ($group["parent"]); +// $data[3] = $group['disabled'] ? __('Disabled') : __('Enabled'); + $data[1] = ''; + + array_push ($table->data, $data); +} + +print_table ($table); + +echo '
'; +echo '
'; +print_submit_button (__('Create module group'), 'crt', false, 'class="sub next"'); +echo '
'; +echo '
'; + +?> diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index c58fd51206..dfdf056308 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -35,6 +35,8 @@ if (give_acl ($config['id_user'], 0, "AW")) { if (give_acl ($config["id_user"], 0, "PM")) { $sub["godmode/groups/group_list"]["text"] = __('Manage groups'); + $sub["godmode/groups/modu_group_list"]["text"] = __('Module groups'); + $sub["godmode/agentes/planned_downtime"]["text"] = __('Scheduled downtime'); }