From 7ca577ce510f99e3a4362e36110be1aaa66c2baa Mon Sep 17 00:00:00 2001 From: m-lopez-f Date: Mon, 6 Jun 2016 13:05:25 +0200 Subject: [PATCH] Reorganizate code for use OS/module groups in metaconsole. Tiquet #3490 --- .../godmode/groups/configure_modu_group.php | 16 ++++++++++--- .../godmode/groups/modu_group_list.php | 13 +++++++---- pandora_console/godmode/setup/os.list.php | 19 +++++++++++++-- pandora_console/godmode/setup/os.php | 16 ++++++++----- pandora_console/godmode/tag/edit_tag.php | 23 +++++++++++-------- pandora_console/godmode/tag/tag.php | 6 ++--- 6 files changed, 66 insertions(+), 27 deletions(-) diff --git a/pandora_console/godmode/groups/configure_modu_group.php b/pandora_console/godmode/groups/configure_modu_group.php index f7eafbf12e..b2e74f7527 100644 --- a/pandora_console/godmode/groups/configure_modu_group.php +++ b/pandora_console/godmode/groups/configure_modu_group.php @@ -19,14 +19,18 @@ global $config; check_login (); +enterprise_hook('open_meta_frame'); + if (! check_acl ($config['id_user'], 0, "PM")) { db_pandora_audit("ACL Violation", "Trying to access Group Management2"); require ("general/noaccess.php"); return; } -// Header -ui_print_page_header (__("Module group management"), "images/module_group.png", false, "", true, ""); +if (!is_metaconsole()) { + // Header + ui_print_page_header (__("Module group management"), "images/module_group.png", false, "", true, ""); +} // Init vars $icon = ""; @@ -67,7 +71,10 @@ $table->data[0][1] = html_print_input_text ('name', $name, '', 35, 100, true); echo''; -echo '
'; +if (is_metaconsole()) + echo ''; +else + echo ''; html_print_table ($table); echo '
'; if ($id_group) { @@ -81,4 +88,7 @@ else { } echo '
'; echo '
'; + +enterprise_hook('close_meta_frame'); + ?> diff --git a/pandora_console/godmode/groups/modu_group_list.php b/pandora_console/godmode/groups/modu_group_list.php index c767f17f9c..a5a9b57fcb 100644 --- a/pandora_console/godmode/groups/modu_group_list.php +++ b/pandora_console/godmode/groups/modu_group_list.php @@ -50,9 +50,10 @@ if (is_ajax ()) { return; } -// Header -ui_print_page_header (__("Module groups defined in Pandora"), "images/module_group.png", false, "", true, ""); - +if (!is_metaconsole()) { + // Header + ui_print_page_header (__("Module groups defined in Pandora"), "images/module_group.png", false, "", true, ""); +} $create_group = (bool) get_parameter ('create_group'); $update_group = (bool) get_parameter ('update_group'); $delete_group = (bool) get_parameter ('delete_group'); @@ -190,9 +191,13 @@ if (!empty($groups)) { foreach ($groups as $id_group ) { $data = array (); $data[0] = $id_group["id_mg"]; + $data[1] = '' . ui_print_truncate_text($id_group["name"], GENERIC_SIZE_TEXT).''; - $data[2] = '' . html_print_image("images/cross.png", true, array("border" => '0')) . ''; + if (is_metaconsole()) + $data[2] = '' . html_print_image("images/cross.png", true, array("border" => '0')) . ''; + else + $data[2] = '' . html_print_image("images/cross.png", true, array("border" => '0')) . ''; array_push ($table->data, $data); } diff --git a/pandora_console/godmode/setup/os.list.php b/pandora_console/godmode/setup/os.list.php index 4e385ae729..581e054721 100644 --- a/pandora_console/godmode/setup/os.list.php +++ b/pandora_console/godmode/setup/os.list.php @@ -49,10 +49,16 @@ foreach ($osList as $os) { $data = array(); $data[] = ui_print_os_icon($os['id_os'], false, true); $data[] = $os['id_os']; - $data[] = '' . io_safe_output($os['name']) . ''; + if(is_metaconsole()) + $data[] = '' . io_safe_output($os['name']) . ''; + else + $data[] = '' . io_safe_output($os['name']) . ''; $data[] = ui_print_truncate_text(io_safe_output($os['description']), 'description', true, true); if ($os['id_os'] > 16) { - $data[] = '' . html_print_image("images/cross.png", true) . ''; + if(is_metaconsole()) + $data[] = '' . html_print_image("images/cross.png", true) . ''; + else + $data[] = '' . html_print_image("images/cross.png", true) . ''; } else { //The original icons of pandora don't delete. @@ -68,4 +74,13 @@ if (isset($data)) { else { ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined operating systems') ) ); } + +if (is_metaconsole()) { + echo '
'; + echo "
"; + html_print_submit_button (__('Create OS'), '', false, 'class="sub next"'); + echo "
"; + echo '
'; +} + ?> diff --git a/pandora_console/godmode/setup/os.php b/pandora_console/godmode/setup/os.php index 04149f5680..b4970f3dbf 100644 --- a/pandora_console/godmode/setup/os.php +++ b/pandora_console/godmode/setup/os.php @@ -26,7 +26,10 @@ if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_us $action = get_parameter('action', 'new'); $idOS = get_parameter('id_os', 0); -$tab = get_parameter('tab', 'list'); +if (is_metaconsole()) + $tab = get_parameter('tab2', 'list'); +else + $tab = get_parameter('tab', 'list'); if ($idOS) { $os = db_get_row_filter('tconfig_os', array('id_os' => $idOS)); @@ -135,18 +138,19 @@ $buttons = array( $buttons[$tab]['active'] = true; -// Header -ui_print_page_header(__('Edit OS'), "", false, "", true, $buttons); - +if (!is_metaconsole()) { + // Header + ui_print_page_header(__('Edit OS'), "", false, "", true, $buttons); +} echo $message; switch ($tab) { case 'list': - require_once('godmode/setup/os.list.php'); + require_once($config['homedir'] . '/godmode/setup/os.list.php'); return; break; case 'builder': - require_once('godmode/setup/os.builder.php'); + require_once($config['homedir'] . '/godmode/setup/os.builder.php'); return; break; } diff --git a/pandora_console/godmode/tag/edit_tag.php b/pandora_console/godmode/tag/edit_tag.php index 08fa5a231e..b3970f09fd 100644 --- a/pandora_console/godmode/tag/edit_tag.php +++ b/pandora_console/godmode/tag/edit_tag.php @@ -45,20 +45,25 @@ if (defined('METACONSOLE')) else $sec = 'gmodules'; -$buttons = array( +if (defined('METACONSOLE')) { + $buttons = array( + 'list' => array( + 'active' => false, + 'text' => '' . + html_print_image ("images/list.png", true, array ("title" => __('List tags'))) .'')); + + $buttons[$tab]['active'] = true; + // Print header + ui_meta_print_header(__('Tags'), "", $buttons); +} +else { + $buttons = array( 'list' => array( 'active' => false, 'text' => '' . html_print_image ("images/list.png", true, array ("title" => __('List tags'))) .'')); -$buttons[$tab]['active'] = true; - -if (defined('METACONSOLE')) { - // Print header - ui_meta_print_header(__('Tags'), "", $buttons); -} -else { - + $buttons[$tab]['active'] = true; // Header ui_print_page_header (__('Tags configuration'), "images/tag.png", false, "", true, $buttons); diff --git a/pandora_console/godmode/tag/tag.php b/pandora_console/godmode/tag/tag.php index 1b2fc0afe6..222979461e 100644 --- a/pandora_console/godmode/tag/tag.php +++ b/pandora_console/godmode/tag/tag.php @@ -86,7 +86,7 @@ if (is_ajax ()) { return; } -enterprise_hook('open_meta_frame'); +//~ enterprise_hook('open_meta_frame'); if (is_metaconsole()) $sec = 'advanced'; @@ -103,7 +103,7 @@ $buttons[$tab]['active'] = true; if (is_metaconsole()) { // Print header - ui_meta_print_header(__('Tags'), "", $buttons); + //ui_meta_print_header(__('Tags'), "", $buttons); } else { // Header @@ -302,7 +302,7 @@ echo ""; echo "
"; -enterprise_hook('close_meta_frame'); +//~ enterprise_hook('close_meta_frame'); ?>