2009-04-29 09:43:01 +02:00
|
|
|
<?php
|
2007-06-08 17:55:53 +02:00
|
|
|
|
2009-06-08 20:21:21 +02:00
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
2010-03-04 17:08:09 +01:00
|
|
|
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
2009-06-08 20:21:21 +02:00
|
|
|
// Please see http://pandorafms.org for full contribution list
|
2008-08-22 20:07:32 +02:00
|
|
|
|
2007-06-08 17:55:53 +02:00
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
2008-08-22 20:07:32 +02:00
|
|
|
// as published by the Free Software Foundation for version 2.
|
2007-06-08 17:55:53 +02:00
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
2010-03-03 18:10:37 +01:00
|
|
|
global $config;
|
|
|
|
|
2010-03-04 17:08:09 +01:00
|
|
|
print_page_header (__('Visual console builder'), "", false, "map_builder", true);
|
2010-02-22 20:03:55 +01:00
|
|
|
|
2010-04-13 19:45:51 +02:00
|
|
|
$id_layout = (int) get_parameter ('id_layout');
|
|
|
|
$copy_layout = (bool) get_parameter ('copy_layout');
|
2010-04-14 09:59:52 +02:00
|
|
|
$delete_layout = (bool) get_parameter ('delete_layout');
|
|
|
|
|
|
|
|
if ($delete_layout) {
|
|
|
|
process_sql_delete ('tlayout_data', array ('id_layout' => $id_layout));
|
|
|
|
$result = process_sql_delete ('tlayout', array ('id' => $id_layout));
|
|
|
|
if ($result) {
|
|
|
|
echo '<h3 class="suc">'.__('Successfully deleted').'</h3>';
|
|
|
|
clean_cache();
|
|
|
|
} else {
|
|
|
|
echo '<h3 class="error">'.__('Not deleted. Error deleting data').'</h3>';
|
|
|
|
}
|
|
|
|
$id_layout = 0;
|
|
|
|
}
|
2010-04-13 19:45:51 +02:00
|
|
|
|
|
|
|
if ($copy_layout) {
|
|
|
|
// Number of inserts
|
|
|
|
$ninsert = (int) 0;
|
|
|
|
|
|
|
|
// Return from DB the source layout
|
|
|
|
$layout_src = get_db_all_rows_filter ("tlayout","id = " . $id_layout);
|
|
|
|
|
|
|
|
// Name of dst
|
|
|
|
$name_dst = get_parameter ("name_dst", $layout_src[0]['name'] . " copy");
|
|
|
|
|
|
|
|
// Create the new Console
|
|
|
|
$idGroup = $layout_src[0]['id_group'];
|
|
|
|
$background = $layout_src[0]['background'];
|
2010-05-05 19:30:29 +02:00
|
|
|
$height = $layout_src[0]['height'];
|
|
|
|
$width = $layout_src[0]['width'];
|
2010-04-13 19:45:51 +02:00
|
|
|
$visualConsoleName = $name_dst;
|
|
|
|
|
2010-05-05 19:30:29 +02:00
|
|
|
$values = array('name' => $visualConsoleName, 'id_group' => $idGroup, 'background' => $background, 'height' => $height, 'width' => $width);
|
2010-04-13 19:45:51 +02:00
|
|
|
$result = process_sql_insert('tlayout', $values);
|
|
|
|
|
|
|
|
$idNewVisualConsole = $result;
|
|
|
|
|
|
|
|
if($result) {
|
|
|
|
$ninsert = 1;
|
|
|
|
|
|
|
|
// Return from DB the items of the source layout
|
|
|
|
$data_layout_src = get_db_all_rows_filter ("tlayout_data", "id_layout = " . $id_layout);
|
|
|
|
|
|
|
|
if(!empty($data_layout_src)){
|
|
|
|
for ($a=0;$a < count($data_layout_src); $a++) {
|
|
|
|
|
|
|
|
// Changing the source id by the new visual console id
|
|
|
|
$data_layout_src[$a]['id_layout'] = $idNewVisualConsole;
|
|
|
|
|
|
|
|
// Unsetting the source's id
|
|
|
|
unset($data_layout_src[$a]['id']);
|
|
|
|
|
|
|
|
// Configure the cloned Console
|
|
|
|
$result = process_sql_insert('tlayout_data', $data_layout_src[$a]);
|
|
|
|
|
|
|
|
if($result)
|
|
|
|
$ninsert++;
|
|
|
|
}// for each item of console
|
|
|
|
|
|
|
|
$inserts = count($data_layout_src) + 1;
|
|
|
|
|
|
|
|
// If the number of inserts is correct, the copy is completed
|
|
|
|
if ($ninsert == $inserts) {
|
2010-05-11 17:17:09 +02:00
|
|
|
echo '<h3 class="suc">'.__('Successfully copied').'</h3>';
|
2010-04-13 19:45:51 +02:00
|
|
|
clean_cache();
|
|
|
|
} else {
|
2010-05-11 17:17:09 +02:00
|
|
|
echo '<h3 class="error">'.__('Not copied. Error copying data').'</h3>';
|
2010-04-13 19:45:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
// If the array is empty the copy is completed
|
2010-05-11 17:17:09 +02:00
|
|
|
echo '<h3 class="suc">'.__('Successfully copied').'</h3>';
|
2010-04-13 19:45:51 +02:00
|
|
|
clean_cache();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2010-05-11 17:17:09 +02:00
|
|
|
echo '<h3 class="error">'.__('Not copied. Error copying data').'</h3>';
|
2010-04-13 19:45:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-03-31 13:44:03 +02:00
|
|
|
$table->width = '500px';
|
|
|
|
$table->data = array ();
|
|
|
|
$table->head = array ();
|
|
|
|
$table->head[0] = __('Map name');
|
|
|
|
$table->head[1] = __('Group');
|
|
|
|
$table->head[2] = __('Items');
|
2010-04-13 19:45:51 +02:00
|
|
|
$table->head[3] = __('Copy');
|
|
|
|
$table->head[4] = __('Delete');
|
2010-03-31 13:44:03 +02:00
|
|
|
$table->align = array ();
|
|
|
|
$table->align[3] = 'center';
|
2010-04-13 19:45:51 +02:00
|
|
|
$table->align[4] = 'center';
|
2010-03-31 13:44:03 +02:00
|
|
|
|
|
|
|
$maps = get_db_all_rows_in_table ('tlayout','name');
|
|
|
|
if (!$maps) {
|
|
|
|
echo '<div class="nf">'.('No maps defined').'</div>';
|
2008-06-26 Esteban Sanchez <estebans@artica.es>
* ajax.php: Sed id_user in config array.
* godmode/menu.php, general/header.php, operation/menu.php: Replaced
lang_label with lang_string().
* general/logon_ok.php: Reduced one indentation level.
* godmode/agentes/agent_manager.php: Replaced lang_label with
lang_string(). Use pandora functions.
* include/functions_html.php, godmode/agentes/configurar_agente.php:
Tab and blankspaces style correction.
* godmode/reporting/map_builder.php: Complete rewritten to provide an
intuitive way of build the maps. It's cool, useful and very simple.
* godmode/reporting/reporting_builder.php: Deleted an output debug.
* godmode/setup/setup.php: Rewritten to use pandora functions. Added a
colorpicker for color settings.
* include/config.php: Reset pandora password. We must solve things
with this file...
* include/functions.php: Check if input is an array on safe_input().
Use filename as id in array returned by list_files().
* include/functions_db.php: Renamed return_coordinate_* functions.
Style correction.
* include/javascript/jquery.js: Updated to 1.2.6.
* include/javascript/jquery.ui.datepicker.js: Code minimized.
* include/javascript/pandora.js: Style correction.
* include/javascript/wz_jsgraphics.js: Added a class to the elements
of a line, so it can be modified using javascript.
* /include/styles/pandora.css: Added style to some tables dropdowns.
Added new styles relative to visual map editor.
* operation/reporting/reporting_viewer.php: Style correction. Added
jQuery UI.
* operation/visual_console/index.php: Use Pandora functions.
* operation/visual_console/render_view.php: Drawing the map is now on
functions_visual_map.php. Added a countdown if a refresh time is set.
Use pandora functions. Style correction.
* reporting/fgraph.php: Style correction. Use graphic_error() if
there's no data on grafico_modulo_sparse().
* images/trash.png: Added to repository. Image used on trash area on
visual map editor.
* images/console/background/africa.jpg,
images/console/background/asia.jpg,
images/console/background/europe.jpg,
images/console/background/north_america.jpg,
images/console/background/oceania.jpg,
images/console/background/shouth_america.jpg,
images/console/background/world.jpg: Added to repository. Useful and
cool map backgrounds.
* include/functions_visual_map.php: Added to repository. Implements
visual map functions like drawing the map.
* include/javascript/jquery.colorpicker.js: Added to repository.
Implements a color picker widget.
* /include/javascript/jquery.countdown.js: Added to repository.
Implements a countdown widget.
* include/javascript/jquery.ui.core.js: Added to repository. jQuery UI
core.
* include/javascript/jquery.ui.draggable.js: Added to repository.
jQuery draggable plugin.
* include/javascript/jquery.ui.droppable.js: Added to repository.
jQuery droppable plugin.
* include/javascript/pandora_visual_console.js: Added to repository.
Function useful to visual map interface.
* include/languages/countdown_*.js: Added to repository. Countdown
localization.
* include/languages/date_es_la.js, include/languages/date_gl.js,
include/languages/time_es_la.js, include/languages/time_gl.js: Added
to repository. Missing localizations.
* include/styles/color-picker.css: Added to repository. Colorpicker
style sheet.
* include/styles/countdown.css: Added to repository. Countdown style
sheet.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@899 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-26 15:26:48 +02:00
|
|
|
} else {
|
2010-03-31 13:44:03 +02:00
|
|
|
foreach ($maps as $map) {
|
|
|
|
if (give_acl ($config['id_user'], $map['id_group'], "AW")){
|
|
|
|
$data = array ();
|
|
|
|
$data[0] = '<a href="index.php?sec=gmap&sec2=godmode/reporting/visual_console_builder&tab=data&action=edit&id_visual_console='.$map['id'].'">'.$map['name'].'</a>';
|
2009-03-04 Sancho Lerena <slerena@artica.es>
* extras/: New directory with extra contents (scripts, tools, samples)
* index.php: Add new permission check for /attachment directory. Probably
could be extended and wrapped into a function. This should be only called
once, this is the reason why is placed here and not in config_process.
* pandora_console_upgrade: Force MYSQL run, even if SQL return error (useful
for applying over a older 3.0 version for example).
* pandoradb_data.sql: Was missing some tconfig variables.
* extras/*.sql: Missing somre tconfig variables and other minor issues fixed
* extensions/update_manager/main.php: Description of update manager patch
wider. Probably needs more formatting in the future.
* extras/sample_login.php: Sample on how to implement autologin feature.
* footer.php: I hope solve the frakkin image problem.
* godmode/agents/agent_manager.php: proper ACL check notice.
* godmode/alerts/alert_list.php: Fixed notice.
* godmode/reporting/map_builder.php: Added link to wizard and item count.
* godmode/reporting/map_builder_wizard.php: Added new feature, a wizard
to populate the visual map, using agents from a combo, depending on the
map selected. Could have a lot of improvements, it's a basic start. Allow
to choose agents and image maps and space between images. Puts in a reticle
automatically adjusting at 600px width.
* godmode/setup.php: Checkbox for trap_forward was bad, fixed.
* config_process.php: Fixed version to 3.0-dev
* functions_html.php: Default of 0 in text boxes makes them unusable on
default values, funny :-)
* include/functions_reporting.php: Fixed a notice on unknown variable
on function get_group_stat().
* operation/agentes/alerts_status.php: Filter on module status is made now
with combos, like the rest of the filters in the GUI.
* operation/events/events.php: a missing div makes graph float outside the
filter box. TODO: Hidder filter makes free-width style buggy here.
* operation/reporting/reporting_viewer.php: Fixed layout issue.
* operation/visual_console/render_view.php: Added ACL check.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1510 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-03-04 18:57:00 +01:00
|
|
|
|
2010-03-31 13:44:03 +02:00
|
|
|
$data[1] = print_group_icon ($map['id_group'], true).' ';
|
2010-04-23 10:23:58 +02:00
|
|
|
$data[1] .= get_group_name ($map['id_group'], true);
|
2010-03-31 13:44:03 +02:00
|
|
|
$data[2] = get_db_sql ("SELECT COUNT(*) FROM tlayout_data WHERE id_layout = ".$map['id']);
|
2007-06-08 17:55:53 +02:00
|
|
|
|
2010-04-13 19:45:51 +02:00
|
|
|
$data[3] = '<a href="index.php?sec=gmap&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'&copy_layout=1">'.print_image ("images/copy.png", true).'</a>';
|
|
|
|
$data[4] = '<a href="index.php?sec=gmap&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'&delete_layout=1">'.print_image ("images/cross.png", true).'</a>';
|
2010-03-31 13:44:03 +02:00
|
|
|
array_push ($table->data, $data);
|
2007-06-08 17:55:53 +02:00
|
|
|
}
|
2009-08-14 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/agent_manager.php, godmode/agentes/massive_config.php,
godmode/alerts/alert_list.php, godmode/reporting/graph_builder.php,
godmode/reporting/map_builder.php, include/functions_db.php,
include/functions_html.php, operation/agentes/exportdata.php,
operation/agentes/ver_agente.php: very changes for add input text
autocomplete with ajax jquery for agent input in several forms. Add to form
this exportdata, graph_builder, map_builder.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1849 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-14 18:38:57 +02:00
|
|
|
}
|
2010-03-31 13:44:03 +02:00
|
|
|
print_table ($table);
|
2009-08-14 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/agent_manager.php, godmode/agentes/massive_config.php,
godmode/alerts/alert_list.php, godmode/reporting/graph_builder.php,
godmode/reporting/map_builder.php, include/functions_db.php,
include/functions_html.php, operation/agentes/exportdata.php,
operation/agentes/ver_agente.php: very changes for add input text
autocomplete with ajax jquery for agent input in several forms. Add to form
this exportdata, graph_builder, map_builder.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1849 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-14 18:38:57 +02:00
|
|
|
}
|
|
|
|
|
2010-03-31 13:44:03 +02:00
|
|
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
|
|
|
echo '<form action="index.php?sec=gmap&sec2=godmode/reporting/visual_console_builder" method="post">';
|
|
|
|
print_input_hidden ('edit_layout', 1);
|
|
|
|
print_submit_button (__('Create'), '', false, 'class="sub next"');
|
|
|
|
echo '</form>';
|
|
|
|
echo '</div>';
|
2010-04-13 19:45:51 +02:00
|
|
|
?>
|