1<?php 2// Pandora FMS - http://pandorafms.com 3// ================================================== 4// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas 5// Please see http://pandorafms.org for full contribution list 6 7// This program is free software; you can redistribute it and/or 8// modify it under the terms of the GNU General Public License 9// as published by the Free Software Foundation for version 2. 10// This program is distributed in the hope that it will be useful, 11// but WITHOUT ANY WARRANTY; without even the implied warranty of 12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13// GNU General Public License for more details. 14 15// Login check 16global $config; 17 18check_login (); 19 20if (empty($idVisualConsole)) { 21 // ACL for the a new visual console 22 // if (!isset($vconsole_read)) 23 // $vconsole_read = check_acl ($config['id_user'], 0, "VR"); 24 if (!isset($vconsole_write)) 25 $vconsole_write = check_acl ($config['id_user'], 0, "VW"); 26 if (!isset($vconsole_manage)) 27 $vconsole_manage = check_acl ($config['id_user'], 0, "VM"); 28} 29else { 30 // ACL for the existing visual console 31 // if (!isset($vconsole_read)) 32 // $vconsole_read = check_acl ($config['id_user'], $idGroup, "VR"); 33 if (!isset($vconsole_write)) 34 $vconsole_write = check_acl ($config['id_user'], $idGroup, "VW"); 35 if (!isset($vconsole_manage)) 36 $vconsole_manage = check_acl ($config['id_user'], $idGroup, "VM"); 37} 38 39if (!$vconsole_write && !$vconsole_manage) { 40 db_pandora_audit("ACL Violation", 41 "Trying to access report builder"); 42 require ("general/noaccess.php"); 43 exit; 44} 45 46require_once ($config['homedir'] . '/include/functions_visual_map.php'); 47require_once ($config['homedir'] . '/include/functions_users.php'); 48 49$pure = get_parameter('pure', 0); 50 51switch ($action) { 52 case 'new': 53 if (!defined('METACONSOLE')) { 54 echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=" . $activeTab . "' enctype='multipart/form-data'>"; 55 html_print_input_hidden('action', 'save'); 56 } 57 else { 58 echo '<form action="index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '" method="post" enctype="multipart/form-data">'; 59 html_print_input_hidden('action2', 'save'); 60 } 61 62 break; 63 case 'update': 64 case 'save': 65 if (!defined('METACONSOLE')) { 66 echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=" . $activeTab . "&id_visual_console=" . $idVisualConsole . "' enctype='multipart/form-data'>"; 67 html_print_input_hidden('action', 'update'); 68 } 69 else { 70 //echo '<form action="index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '" method="post">'; 71 echo "<form action='index.php?sec=screen&sec2=screens/screens&tab=" . $activeTab . "&id_visual_console=" . $idVisualConsole . "&id_visualmap=" . $idVisualConsole . "&action=visualmap' method='post' enctype='multipart/form-data'>"; 72 html_print_input_hidden('action2', 'update'); 73 } 74 break; 75 case 'edit': 76 if (!defined('METACONSOLE')) { 77 echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=" . $activeTab . "&id_visual_console=" . $idVisualConsole . "' enctype='multipart/form-data'>"; 78 html_print_input_hidden('action', 'update'); 79 } 80 else { 81 echo "<form action='index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&tab=" . $activeTab . "&id_visual_console=" . $idVisualConsole . "&action=visualmap' method='post' enctype='multipart/form-data' >"; 82 html_print_input_hidden('action2', 'update'); 83 } 84 break; 85} 86 87$table = new stdClass(); 88$table->width = '100%'; 89if (defined('METACONSOLE')) { 90 $table->class = 'databox data'; 91 $table->head[0] = __("Create visual console"); 92 $table->head_colspan[0] = 5; 93 $table->headstyle[0] = 'text-align: center'; 94 $table->align[0] = 'left'; 95 $table->align[1] = 'left'; 96} 97$table->class = 'databox filters'; 98$table->data = array (); 99$table->data[0][0] = __('Name:') . 100 ui_print_help_tip(__("Use [ or ( as first character, for example '[*] Map name', to render this map name in main menu"), true); 101 102$table->data[0][1] = html_print_input_text('name', $visualConsoleName, 103 '', 80, 100, true); 104$table->data[1][0] = __('Group:'); 105$groups = users_get_groups ($config['id_user'], 'RW'); 106 107$own_info = get_user_info($config['id_user']); 108// Only display group "All" if user is administrator 109// or has "RW" privileges 110if ($own_info['is_admin'] || $vconsole_write || $vconsole_manage) 111 $display_all_group = true; 112else 113 $display_all_group = false; 114 115$table->data[1][1] = html_print_select_groups($config['id_user'], "RW", 116 $display_all_group, 'id_group', $idGroup, '', '', '', true); 117$backgrounds_list = list_files( 118 $config['homedir'] . '/images/console/background/', "jpg", 1, 0); 119$backgrounds_list = array_merge($backgrounds_list, 120 list_files($config['homedir'] . '/images/console/background/', "png", 1, 0)); 121$table->data[2][0] = __('Background'); 122$table->data[2][1] = html_print_select($backgrounds_list, 'background', 123 $background, '', '', 0, true); 124$table->data[3][0] = __('Background image'); 125$table->data[3][1] = html_print_input_file('background_image',true); 126if ($action == 'new') { 127 $textButtonSubmit = __('Save'); 128 $classButtonSubmit = 'sub wand'; 129} 130else { 131 $textButtonSubmit = __('Update'); 132 $classButtonSubmit = 'sub upd'; 133} 134 135html_print_table($table); 136 137echo '<div class="action-buttons" style="width: '.$table->width.'">'; 138html_print_submit_button ($textButtonSubmit, 'update_layout', false, 139 'class="' . $classButtonSubmit . '"'); 140echo '</div>'; 141 142echo "</form>"; 143?> 144