2012-07-03 Miguel de Dios <miguel.dedios@artica.es>

* ajax.php: added support for the enterprise, because some case
	this file can't call enterprise functions.
	
	* godmode/reporting/visual_console_builder.wizard.php,
	godmode/reporting/visual_console_builder.php,
	godmode/reporting/visual_console_builder.editor.js,
	godmode/reporting/visual_console_builder.elements.php,
	godmode/reporting/visual_console_builder.editor.php,
	godmode/reporting/visual_console_builder.constans.php (delete),
	include/functions_visual_map_editor.php,
	include/ajax/visual_console_builder.ajax.php,
	include/functions_visual_map.php: some parts of code had been
	refactored because it is necesary for to add enterprise feature to
	Visual map.
	
	* include/constants.php: cleaned source code style and added and
	reordened the constants for visual maps.
	
	* include/functions_html.php, include/styles/pandora.css,
	include/functions_ui.php, include/functions.php, index.php: cleaned
	source code style.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6732 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-07-03 15:39:37 +00:00
parent d5fec61b8a
commit 86213977b4
17 changed files with 820 additions and 553 deletions

View File

@ -1,3 +1,27 @@
2012-07-03 Miguel de Dios <miguel.dedios@artica.es>
* ajax.php: added support for the enterprise, because some case
this file can't call enterprise functions.
* godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.elements.php,
godmode/reporting/visual_console_builder.editor.php,
godmode/reporting/visual_console_builder.constans.php (delete),
include/functions_visual_map_editor.php,
include/ajax/visual_console_builder.ajax.php,
include/functions_visual_map.php: some parts of code had been
refactored because it is necesary for to add enterprise feature to
Visual map.
* include/constants.php: cleaned source code style and added and
reordened the constants for visual maps.
* include/functions_html.php, include/styles/pandora.css,
include/functions_ui.php, include/functions.php, index.php: cleaned
source code style.
2012-07-03 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql

View File

@ -31,6 +31,11 @@ check_login ();
define ('AJAX', true);
/* Enterprise support */
if (file_exists (ENTERPRISE_DIR."/load_enterprise.php")) {
include_once (ENTERPRISE_DIR."/load_enterprise.php");
}
$config["remote_addr"] = $_SERVER['REMOTE_ADDR'];
$page = (string) get_parameter ('page');

View File

@ -1,31 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// 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.
//constants
define('STATIC_GRAPH', 0);
define('PERCENTILE_BAR', 3);
define('MODULE_GRAPH', 1);
define('SIMPLE_VALUE', 2);
define('LABEL', 4);
define('ICON', 5);
define('SIMPLE_VALUE_MAX', 6);
define('SIMPLE_VALUE_MIN', 7);
define('SIMPLE_VALUE_AVG', 8);
define('PERCENTILE_BUBBLE', 9);
define('PROCESS_VALUE_NONE', 0);
define('PROCESS_VALUE_MIN', 1);
define('PROCESS_VALUE_MAX', 2);
define('PROCESS_VALUE_AVG', 3);
?>

View File

@ -12,7 +12,7 @@
// GNU General Public License for more details.
var creationItem = null;
var openPropertiesPanel = false;
var is_opened_palette = false;
var idItem = 0;
var selectedItem = null;
var lines = Array();
@ -23,7 +23,7 @@ var temp_id_item = 0;
var SIZE_GRID = 16; //Const the size (for width and height) of grid.
function showAdvanceOptions(close) {
function toggle_advance_options_palette(close) {
if ($("#advance_options").css('display') == 'none') {
$("#advance_options").css('display', '');
}
@ -37,7 +37,7 @@ function showAdvanceOptions(close) {
}
// Main function, execute in event documentReady
function initJavascript() {
function visual_map_main() {
$(".label_color").attachColorPicker();
eventsBackground();
@ -50,7 +50,6 @@ function initJavascript() {
}
);
$(".item").css('z-index', '1'); //For paint the icons over lines
}
function eventsTextAgent() {
@ -142,13 +141,13 @@ function eventsTextAgent() {
$(".ui-autocomplete").css("text-align", "left");
}
function cancelAction() {
if (openPropertiesPanel) {
actionClick();
}
function cancel_button_palette_callback() {
if (is_opened_palette) {
toggle_item_palette();
}
}
function updateAction() {
function update_button_palette_callback() {
var values = {};
values = readFields();
@ -255,11 +254,17 @@ function updateAction() {
$("#" + idItem).css('height', '');
}
break;
default:
//Maybe save in any Enterprise item.
if (typeof(enterprise_update_button_palette_callback) == 'function') {
enterprise_update_button_palette_callback(values);
}
break;
}
updateDB(selectedItem, idItem , values);
actionClick();
toggle_item_palette();
}
function readFields() {
@ -286,11 +291,16 @@ function readFields() {
values['type_percentile'] = $("input[name=type_percentile]:checked").val();
values['value_show'] = $("input[name=value_show]:checked").val();
if (typeof(enterprise_readFields) == 'function') {
//The parameter is a object and the function can change or add
//attributes.
enterprise_readFields(values);
}
return values;
}
function createAction() {
function create_button_palette_callback() {
var values = readFields();
//VALIDATE DATA
@ -357,18 +367,26 @@ function createAction() {
validate = false;
}
break;
default:
//Maybe save in any Enterprise item.
if (typeof(enterprise_create_button_palette_callback) == 'function') {
validate = enterprise_create_button_palette_callback(values);
}
break;
}
if (validate) {
insertDB(creationItem, values);
actionClick();
toggle_item_palette();
}
}
function actionClick() {
function toggle_item_palette() {
var item = null;
if (openPropertiesPanel) {
if (is_opened_palette) {
is_opened_palette = false;
activeToolboxButton('static_graph', true);
activeToolboxButton('module_graph', true);
activeToolboxButton('simple_value', true);
@ -376,60 +394,64 @@ function actionClick() {
activeToolboxButton('icon', true);
activeToolboxButton('percentile_item', true);
if (typeof(enterprise_activeToolboxButton) == 'function') {
enterprise_activeToolboxButton(true);
}
$(".item").draggable("enable");
$("#background").resizable('enable');
$("#properties_panel").hide("fast");
showAdvanceOptions(false);
openPropertiesPanel = false;
return;
toggle_advance_options_palette(false);
}
openPropertiesPanel = true;
$(".item").draggable("disable");
$("#background").resizable('disable');
activeToolboxButton('static_graph', false);
activeToolboxButton('module_graph', false);
activeToolboxButton('simple_value', false);
activeToolboxButton('label', false);
activeToolboxButton('icon', false);
activeToolboxButton('percentile_item', false);
activeToolboxButton('edit_item', false);
activeToolboxButton('delete_item', false);
activeToolboxButton('show_grid', false);
if (creationItem != null) {
//Create a item
else {
is_opened_palette = true;
activeToolboxButton(creationItem, true);
item = creationItem;
$("#button_update_row").css('display', 'none');
$("#button_create_row").css('display', '');
cleanFields();
unselectAll();
$(".item").draggable("disable");
$("#background").resizable('disable');
activeToolboxButton('static_graph', false);
activeToolboxButton('module_graph', false);
activeToolboxButton('simple_value', false);
activeToolboxButton('label', false);
activeToolboxButton('icon', false);
activeToolboxButton('percentile_item', false);
activeToolboxButton('edit_item', false);
activeToolboxButton('delete_item', false);
activeToolboxButton('show_grid', false);
if (typeof(enterprise_activeToolboxButton) == 'function') {
enterprise_activeToolboxButton(false);
}
if (creationItem != null) {
//Create a item
activeToolboxButton(creationItem, true);
item = creationItem;
$("#button_update_row").css('display', 'none');
$("#button_create_row").css('display', '');
cleanFields();
unselectAll();
}
else if (selectedItem != null) {
//Edit a item
item = selectedItem;
toolbuttonActive = item;
activeToolboxButton(toolbuttonActive, true);
$("#button_create_row").css('display', 'none');
$("#button_update_row").css('display', '');
cleanFields();
loadFieldsFromDB(item);
}
hiddenFields(item);
$("#properties_panel").show("fast");
}
else if (selectedItem != null) {
//Edit a item
item = selectedItem;
toolbuttonActive = item;
activeToolboxButton(toolbuttonActive, true);
$("#button_create_row").css('display', 'none');
$("#button_update_row").css('display', '');
cleanFields();
loadFieldsFromDB(item);
}
hiddenFields(item);
$("#properties_panel").show("fast");
}
function loadFieldsFromDB(item) {
@ -474,7 +496,8 @@ function loadFieldsFromDB(item) {
moduleId = val;
$("select[name=module]").val(val);
}
if (key == 'process_value') $("select[name=process_value]").val(val);
if (key == 'process_value')
$("select[name=process_value]").val(val);
if (key == 'period') {
var anySelected = false;
var periodId = $('#hidden-period').attr('class');
@ -527,6 +550,10 @@ function loadFieldsFromDB(item) {
}
}
});
if (typeof(enterprise_loadFieldsFromDB) == 'function') {
enterprise_loadFieldsFromDB(data);
}
}
});
}
@ -577,7 +604,7 @@ function setAspectRatioBackground(side) {
}
});
actionClick();
toggle_item_palette();
}
function hiddenFields(item) {
@ -611,7 +638,7 @@ function hiddenFields(item) {
$("#module_row." + item).css('display', '');
$("#process_value_row").css('display', 'none');
$("#process_value_row." + item).css('display', '');
$("#process_value_row." + item).css('display', '');
$("#background_row_1").css('display', 'none');
$("#background_row_1." + item).css('display', '');
@ -1073,6 +1100,15 @@ function createItem(type, values, id_data) {
'</div>'
);
break;
default:
//Maybe create in any Enterprise item.
if (typeof(enterprise_createItem) == 'function') {
temp_item = enterprise_createItem(type, values, id_data);
if (temp_item != false) {
item = temp_item;
}
}
break;
}
$("#background").append(item);
@ -1080,9 +1116,9 @@ function createItem(type, values, id_data) {
if (values['parent'] != 0) {
var line = {"id": id_data,
"node_begin": values['parent'],
"node_end": id_data,
"color": visual_map_get_color_line_status(id_data) };
"node_begin": values['parent'],
"node_end": id_data,
"color": visual_map_get_color_line_status(id_data) };
lines.push(line);
refresh_lines(lines, 'background', true);
@ -1117,6 +1153,7 @@ function insertDB(type, values) {
id = data['id_data'];
createItem(type, values, id);
addItemSelectParents(id, data['text']);
//Reload all events for the item and new item.
eventsItems();
}
else {
@ -1167,10 +1204,10 @@ function updateDB_visual(type, idElement , values, event, top, left) {
suffix = "_warning.png";
break;
case '3':
//Unknown
default:
//Unknown
suffix = ".png";
// Default is Grey (Other)
break;
}
var params = [];
@ -1264,14 +1301,14 @@ function updateDB(type, idElement , values, event) {
}
parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: action});
parameter.push ({name: "id_visual_console", value: id_visual_console});
parameter.push ({name: "type", value: type});
parameter.push ({name: "id_element", value: idElement});
parameter.push({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push({name: "action", value: action});
parameter.push({name: "id_visual_console", value: id_visual_console});
parameter.push({name: "type", value: type});
parameter.push({name: "id_element", value: idElement});
jQuery.each(values, function(key, val) {
parameter.push ({name: key, value: val});
parameter.push({name: key, value: val});
});
if ((typeof(values['mov_left']) != 'undefined') &&
@ -1361,7 +1398,7 @@ function activeToolboxButton(id, active) {
}
}
function deleteItem() {
function click_delete_item_callback() {
activeToolboxButton('edit_item', false);
deleteDB(idItem);
idItem = 0;
@ -1383,11 +1420,11 @@ function eventsItems(drag) {
$('.item').unbind('dragstart');
$(".item").draggable('destroy');
//$(".item").resizable(); //Disable but run in ff and in ie show ungly borders
//$(".item").resizable(); //Disable but run in ff and in the waste (aka micro$oft IE) show ungly borders
$('.item').bind('click', function(event, ui) {
event.stopPropagation();
if (!openPropertiesPanel) {
if (!is_opened_palette) {
divParent = $(event.target).parent();
unselectAll();
$(divParent).css('border', '2px blue dotted');
@ -1440,14 +1477,19 @@ function eventsItems(drag) {
activeToolboxButton('delete_item', true);
activeToolboxButton('show_grid', false);
}
//Maybe receive a click event any Enterprise item.
if (typeof(enterprise_click_item_callback) == 'function') {
enterprise_click_item_callback(divParent);
}
}
});
//Double click in the item
$('.item').bind('dblclick', function(event, ui) {
event.stopPropagation();
if ((!openPropertiesPanel) && (autosave)) {
actionClick();
if ((!is_opened_palette) && (autosave)) {
toggle_item_palette();
}
});
@ -1457,7 +1499,7 @@ function eventsItems(drag) {
$('.item').bind('dragstart', function(event, ui) {
event.stopPropagation();
if (!openPropertiesPanel) {
if (!is_opened_palette) {
unselectAll();
$(event.target).css('border', '2px blue dotted');
@ -1481,6 +1523,13 @@ function eventsItems(drag) {
selectedItem = 'icon';
}
if (selectedItem == null) {
//Maybe receive a click event any Enterprise item.
if (typeof(enterprise_dragstart_item_callback) == 'function') {
selectedItem = enterprise_dragstart_item_callback(event);
}
}
if (selectedItem != null) {
creationItem = null;
idItem = $(event.target).attr('id');
@ -1508,13 +1557,13 @@ function eventsBackground() {
$("#background").resizable();
$('#background').bind('resizestart', function(event, ui) {
if (!openPropertiesPanel) {
if (!is_opened_palette) {
$("#background").css('border', '2px red solid');
}
});
$('#background').bind('resizestop', function(event, ui) {
if (!openPropertiesPanel) {
if (!is_opened_palette) {
unselectAll();
var values = {};
@ -1539,7 +1588,7 @@ function eventsBackground() {
// Event click for background
$("#background").click(function(event) {
event.stopPropagation();
if (!openPropertiesPanel) {
if (!is_opened_palette) {
unselectAll();
$("#background").css('border', '2px blue dotted');
activeToolboxButton('edit_item', true);
@ -1554,8 +1603,8 @@ function eventsBackground() {
$('#background').bind('dblclick', function(event, ui) {
event.stopPropagation();
if ((!openPropertiesPanel) && (autosave)) {
actionClick();
if ((!is_opened_palette) && (autosave)) {
toggle_item_palette();
}
});
}
@ -1595,35 +1644,35 @@ function click_button_toolbox(id) {
switch (id) {
case 'static_graph':
toolbuttonActive = creationItem = 'static_graph';
actionClick();
toggle_item_palette();
break;
case 'percentile_bar':
case 'percentile_item':
toolbuttonActive = creationItem = 'percentile_item';
actionClick();
toggle_item_palette();
break;
case 'module_graph':
toolbuttonActive = creationItem = 'module_graph';
actionClick();
toggle_item_palette();
break;
case 'simple_value':
toolbuttonActive = creationItem = 'simple_value';
actionClick();
toggle_item_palette();
break;
case 'label':
toolbuttonActive = creationItem = 'label';
actionClick();
toggle_item_palette();
break;
case 'icon':
toolbuttonActive = creationItem = 'icon';
actionClick();
toggle_item_palette();
break;
case 'edit_item':
actionClick();
toggle_item_palette();
break;
case 'delete_item':
deleteItem();
click_delete_item_callback();
break;
case 'show_grid':
showGrid();
@ -1696,10 +1745,16 @@ function click_button_toolbox(id) {
alert($('#hack_translation_correct_save').html());
}
else {
alert($('#hack_translation_incorrect_save').html());
alert($('#hack_translation_incorrect_save').html());
}
activeToolboxButton('save', true);
break;
default:
//Maybe click in any Enterprise button in toolbox.
if (typeof(enterprise_click_button_toolbox) == 'function') {
enterprise_click_button_toolbox(id);
}
break;
}
}
@ -1768,10 +1823,10 @@ function showPreviewIcon(icon) {
function showGrid() {
var display = $("#background_grid").css('display');
if (display == 'none'){
if (display == 'none') {
$("#background_grid").css('display', '');
$("#background_img").css('opacity', '0.55');
$("#background_img").css('filter', 'alpha(opacity=55)');
$("#background_img").css('filter', 'alpha(opacity=55)');
$("#background_grid").css('background', 'url("images/console/background/white_boxed.jpg")');
//Snap to grid all elements.

View File

@ -24,253 +24,24 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
exit;
}
require_once('godmode/reporting/visual_console_builder.constans.php');
require_once ('include/functions_visual_map.php');
require_once ('include/functions_visual_map_editor.php');
enterprise_include_once('include/functions_visual_map_editor.php');
//Arrays for select box.
$backgrounds_list = list_files('images/console/background/', "jpg", 1, 0);
$backgrounds_list = array_merge($backgrounds_list, list_files ('images/console/background/', "png", 1, 0));
visual_map_editor_print_toolbox();
$images_list = array ();
$all_images = list_files ('images/console/icons/', "png", 1, 0);
foreach ($all_images as $image_file) {
if (strpos ($image_file, "_bad"))
continue;
if (strpos ($image_file, "_ok"))
continue;
if (strpos ($image_file, "_warning"))
continue;
$image_file = substr ($image_file, 0, strlen ($image_file) - 4);
$images_list[$image_file] = $image_file;
}
echo '<div id="editor" style="margin-top: -10px;">';
echo '<div id="toolbox">';
visual_map_print_button_editor('static_graph', __('Static Graph'), 'left', false, 'camera_min', true);
visual_map_print_button_editor('percentile_item', __('Percentile Item'), 'left', false, 'percentile_item_min', true);
visual_map_print_button_editor('module_graph', __('Module Graph'), 'left', false, 'graph_min', true);
visual_map_print_button_editor('simple_value', __('Simple Value'), 'left', false, 'binary_min', true);
visual_map_print_button_editor('label', __('Label'), 'left', false, 'label_min', true);
visual_map_print_button_editor('icon', __('Icon'), 'left', false, 'icon_min', true);
visual_map_print_button_editor('save', __('Save'), 'right', true, 'save_min', true);
$text_autosave = __('Auto Save') . html_print_checkbox('auto_save', 0, true, true, false, "click_button_toolbox('auto_save');");
visual_map_print_item_toolbox('auto_save', $text_autosave, 'right');
visual_map_print_button_editor('show_grid', __('Show grid'), 'right', true, 'grid_min', true);
visual_map_print_button_editor('edit_item', __('Update item'), 'right', true, 'config_min', true);
visual_map_print_button_editor('delete_item', __('Delete item'), 'right', true, 'delete_min', true);
echo '</div>';
echo '</div>';
echo '<div style="clear: right; margin-bottom: 10px;"></div>';
echo "<form id='form_visual_map' method='post' action='index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=" . $activeTab . "&id_visual_console=" . $idVisualConsole . "'>";
html_print_input_hidden('action', 'update');
$background = $visualConsole['background'];
$widthBackground = $visualConsole['width'];
$heightBackground = $visualConsole['height'];
$layoutDatas = db_get_all_rows_field_filter ('tlayout_data', 'id_layout', $idVisualConsole);
$layoutDatas = db_get_all_rows_field_filter ('tlayout_data',
'id_layout', $idVisualConsole);
if ($layoutDatas === false)
$layoutDatas = array();
//Trick for it have a traduct text for javascript.
echo '<span id="any_text" style="display: none;">' . __('Any') . '</span>';
echo '<span id="ip_text" style="display: none;">' . __('IP') . '</span>';
visual_map_editor_print_item_palette($visualConsole['id'], $background);
echo '<div id="properties_panel" style="display: none; position: absolute; border: 2px solid #114105; padding: 5px; background: white; z-index: 90;">';
//----------------------------Hiden Form----------------------------------------
?>
<table class="databox" border="0" cellpadding="4" cellspacing="4" width="300">
<caption>
<span id="title_panel_span_background"
class="title_panel_span"
style="display: none; visibility:hidden; font-weight: bolder;"><?php echo __('Background');?></span>
<span id="title_panel_span_static_graph"
class="title_panel_span"
style="display: none; font-weight: bolder;"><?php echo __('Static Graph');?></span>
<span id="title_panel_span_percentile_item"
class="title_panel_span"
style="display: none; font-weight: bolder;"><?php echo __('Percentile Item');?></span>
<span id="title_panel_span_module_graph"
class="title_panel_span"
style="display: none; font-weight: bolder;"><?php echo __('Module Graph');?></span>
<span id="title_panel_span_simple_value"
class="title_panel_span"
style="display: none; font-weight: bolder;"><?php echo __('Simple value');?></span>
<span id="title_panel_span_label"
class="title_panel_span"
style="display: none; font-weight: bolder;"><?php echo __('Label');?></span>
<span id="title_panel_span_icon"
class="title_panel_span"
style="display: none; font-weight: bolder;"><?php echo __('Icon');?></span>
</caption>
<tbody>
<tr id="label_row" style="" class="static_graph percentile_bar percentile_item module_graph simple_value label datos icon">
<td style=""><?php echo __('Label');?></td>
<td style=""><?php html_print_input_text ('label', '', '', 20, 200); ?></td>
</tr>
<tr id="image_row" style="" class="static_graph icon datos">
<td><?php echo __('Image');?></td>
<td><?php html_print_select ($images_list, 'image', '', 'showPreview(this.value);', 'None', '');?></td>
</tr>
<tr id="preview_row" style="" class="static_graph datos icon">
<td colspan="2" style="text-align: right;"><div id="preview" style="text-align: right;"></div></td>
</tr>
<tr id="agent_row" class="static_graph percentile_bar percentile_item module_graph simple_value datos">
<td><?php echo __('Agent') . '<a href="#" class="tip">&nbsp;<span>' . __("Type at least two characters to search.") . '</span></a>';?></td>
<td><?php html_print_input_text_extended ('agent', '', 'text-agent', '', 25, 100, false, '',
array('style' => 'background: #ffffff url(images/lightning.png) no-repeat right;'), false);?></td>
</tr>
<tr id="module_row" class="static_graph percentile_bar percentile_item module_graph simple_value datos">
<td><?php echo __('Module');?></td>
<td><?php html_print_select (array (), 'module', '', '', __('Any'), 0);?></td>
</tr>
<tr id="process_value_row" class="simple_value datos">
<td><?php echo '<span>' . __('Process') . '</span>';?></td>
<td><?php html_print_select (
array (PROCESS_VALUE_MIN => __('Min value'),
PROCESS_VALUE_MAX => __('Max value'),
PROCESS_VALUE_AVG => __('Avg value')), 'process_value', '', '', __('None'), PROCESS_VALUE_NONE);?></td>
</tr>
<tr id="background_row_1" class="background datos">
<td><?php echo __('Background');?></td>
<td><?php html_print_select($backgrounds_list, 'background_image', $background, '', 'None', '');?></td>
</tr>
<tr id="background_row_2" class="background datos">
<td><?php echo __('Original Size');?></td>
<td><?php html_print_button(__('Apply'), 'original_false', false, "setAspectRatioBackground('original')", 'class="sub"');?></td>
</tr>
<tr id="background_row_3" class="background datos">
<td><?php echo __('Aspect ratio');?></td>
<td><?php html_print_button(__('Width proportional'), 'original_false', false, "setAspectRatioBackground('width')", 'class="sub"');?></td>
</tr>
<tr id="background_row_4" class="background datos">
<td></td>
<td><?php html_print_button(__('Height proportional'), 'original_false', false, "setAspectRatioBackground('height')", 'class="sub"');?></td>
</tr>
<tr id="percentile_bar_row_1" class="percentile_bar percentile_item datos">
<td><?php echo __('Width');?></td>
<td>
<?php
html_print_input_text('width_percentile', 0, '', 3, 5);
?>
</td>
</tr>
<tr id="percentile_bar_row_2" class="percentile_bar percentile_item datos">
<td><?php echo __('Max value');?></td>
<td>
<?php
html_print_input_text('max_percentile', 0, '', 3, 5);
?>
</td>
</tr>
<tr id="percentile_item_row_3" class="percentile_item datos">
<td><?php echo __('Type');?></td>
<td>
<?php
html_print_radio_button_extended('type_percentile', 'percentile', ('Percentile'), 'percentile', false, '', 'style="float: left;"', false);
html_print_radio_button_extended('type_percentile', 'bubble', ('Bubble'), 'percentile', false, '', 'style="float: left;"', false);
?>
</td>
</tr>
<tr id="percentile_item_row_4" class="percentile_item datos">
<td><?php echo __('Value to show');?></td>
<td>
<?php
html_print_radio_button_extended('value_show', 'percent', ('Percent'), 'value', false, '', 'style="float: left;"', false);
html_print_radio_button_extended('value_show', 'value', ('Value'), 'value', false, '', 'style="float: left;"', false);
?>
</td>
</tr>
<tr id="period_row" class="module_graph simple_value datos">
<td><?php echo __('Period');?></td>
<td><?php
html_print_extended_select_for_time ('period', '', '', '', '')
?>
</td>
</tr>
<tr id="module_graph_size_row" class="module_graph datos">
<td><?php echo __('Size');?></td>
<td>
<?php
html_print_input_text('width_module_graph', 300, '', 3, 5);
echo ' X ';
html_print_input_text('height_module_graph', 180, '', 3, 5);
?>
</td>
</tr>
<tr id="button_update_row" class="datos">
<td colspan="2" style="text-align: right;">
<?php
html_print_button(__('Cancel'), 'cancel_button', false, 'cancelAction();', 'class="sub cancel"');
html_print_button(__('Update'), 'update_button', false, 'updateAction();', 'class="sub upd"');
?>
</td>
</tr>
<tr id="button_create_row" class="datos">
<td colspan="2" style="text-align: right;">
<?php
html_print_button(__('Cancel'), 'cancel_button', false, 'cancelAction();', 'class="sub cancel"');
html_print_button(__('Create'), 'create_button', false, 'createAction();', 'class="sub wand"');
?>
</td>
</tr>
<tr id="advance_options_link" class="datos">
<td colspan="2" style="text-align: center;">
<a href="javascript: showAdvanceOptions()"><?php echo __('Advanced options');?></a>
</td>
</tr>
</tbody>
<tbody id="advance_options" style="display: none;">
<tr id="position_row" class="static_graph percentile_bar percentile_item module_graph simple_value label icon datos">
<td><?php echo __('Position');?></td>
<td>
<?php
echo '(';
html_print_input_text('left', '0', '', 3, 5);
echo ' , ';
html_print_input_text('top', '0', '', 3, 5);
echo ')';
?>
</td>
</tr>
<tr id="size_row" class="background static_graph icon datos">
<td><?php echo __('Size') . '<a href="#" class="tip">&nbsp;<span>' . __("For use the original image file size, set 0 width and 0 height.") . '</span></a>';?></td>
<td>
<?php
html_print_input_text('width', 0, '', 3, 5);
echo ' X ';
html_print_input_text('height', 0, '', 3, 5);
?>
</td>
</tr>
<tr id="parent_row" class="static_graph percentile_bar percentile_item module_graph simple_value label icon datos">
<td><?php echo __('Parent');?></td>
<td>
<?php
$parents = visual_map_get_items_parents($visualConsole['id']);
html_print_select($parents, 'parent', '', '', __('None'), 0);
?>
</td>
</tr>
<tr id="map_linked_row" class="static_graph percentile_bar percentile_item module_graph simple_value icon label datos">
<td><?php echo __('Map linked');?></td>
<td>
<?php
html_print_select_from_sql ('SELECT id, name FROM tlayout WHERE id != ' . $idVisualConsole, 'map_linked', '', '', 'None', '0');
?>
</td>
</tr>
<tr id="label_color_row" class="static_graph percentile_bar percentile_item module_graph simple_value label datos">
<td><?php echo __('Label color');?></td>
<td><?php html_print_input_text_extended ('label_color', '#000000', 'text-'.'label_color', '', 7, 7, false, '', 'class="label_color"', false);?></td>
</tr>
</tbody>
</table>
<?php
//------------------------------------------------------------------------------
echo '</div>';
echo '<div id="frame_view" style="width: 100%; height: 500px; overflow: scroll;">';
echo '<div id="background" class="" style="
border: 2px black solid; width: ' . $widthBackground . 'px; height: ' . $heightBackground . 'px;">';
@ -280,6 +51,7 @@ echo "<div id='background_grid'
background-repeat: repeat; width: " . $widthBackground . "px; height: " . $heightBackground . "px;'></div>";
//Print the layout datas from the DB.
foreach ($layoutDatas as $layoutData) {
// Pending delete and disable modules must be ignored
$delete_pending_module = db_get_value ("delete_pending", "tagente_modulo", "id_agente_modulo", $layoutData["id_agente_modulo"]);
@ -301,38 +73,23 @@ html_print_input_hidden('background_width', $widthBackground);
html_print_input_hidden('background_height', $heightBackground);
$backgroundSizes = getimagesize('images/console/background/' . $background);
html_print_input_hidden('background_original_width', $backgroundSizes[0]);
html_print_input_hidden('background_original_height', $backgroundSizes[1]);
echo "</form>";
//Hack to translate messages in javascript
echo '<span style="display: none" id="message_alert_no_label_no_image">' . __('No image or name defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_label">' . __('No label defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_image">' . __('No image defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_process">' . __('No process defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_max_percentile">' . __('No Max value defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_width_percentile">' . __('No width defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_period">' . __('No period defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_agent">' . __('No agent defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_module">' . __('No module defined.') .'</span>';
echo '<span style="display: none" id="hack_translation_correct_save">' . __('Successfully save the changes.') .'</span>';
echo '<span style="display: none" id="hack_translation_incorrect_save">' . __('Could not be save') .'</span>';
//CSS
ui_require_css_file ('color-picker');
ui_require_css_file ('jquery-ui-1.8.17.custom');
//Javascript
ui_require_jquery_file('jquery-ui-1.8.17.custom.min');
ui_require_jquery_file('colorpicker');
ui_require_javascript_file('wz_jsgraphics');
ui_require_javascript_file('pandora_visual_console');
//ui_require_jquery_file ('autocomplete');
ui_require_javascript_file('visual_console_builder.editor', 'godmode/reporting/');
ui_require_javascript_file_enterprise('functions_visualmap');
// Javascript file for base 64 encoding of label parameter
ui_require_javascript_file ('encode_decode_base64');
?>
@ -344,5 +101,5 @@ ui_require_javascript_file ('encode_decode_base64');
</style>
<script type="text/javascript">
id_visual_console = <?php echo $visualConsole['id']; ?>;
$(document).ready (initJavascript);
$(document).ready (visual_map_main);
</script>

View File

@ -24,9 +24,9 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
exit;
}
require_once('godmode/reporting/visual_console_builder.constans.php');
require_once ('include/functions_visual_map.php');
require_once ($config['homedir'].'/include/functions_agents.php');
enterprise_include_once('include/functions_visual_map.php');
//Arrays for select box.
$backgrounds_list = list_files('images/console/background/', "jpg", 1, 0);
@ -40,7 +40,7 @@ foreach ($all_images as $image_file) {
if (strpos ($image_file, "_ok"))
continue;
if (strpos ($image_file, "_warning"))
continue;
continue;
$image_file = substr ($image_file, 0, strlen ($image_file) - 4);
$images_list[$image_file] = $image_file;
}
@ -121,7 +121,12 @@ foreach ($layoutDatas as $layoutData) {
$table->data[$i + 1]['icon'] = html_print_image('images/photo.png', true, array('title' => __('Icon')));
break;
default:
$table->data[$i + 1]['icon'] = '';
if (enterprise_installed()) {
$table->data[$i + 1]['icon'] = enterprise_visual_map_print_list_element('icon', $layoutData);
}
else {
$table->data[$i + 1]['icon'] = '';
}
break;
}
@ -129,7 +134,7 @@ foreach ($layoutDatas as $layoutData) {
//Label and color label
if ($layoutData['type'] != ICON) {
$table->data[$i + 1][0] = '<span style="width: 130px; display: block;">' .
$table->data[$i + 1][0] = '<span style="width: 150px; display: block;">' .
html_print_input_text ('label_' . $idLayoutData, $layoutData['label'], '', 10, 200, true) .
html_print_input_text_extended ('label_color_' . $idLayoutData, $layoutData['label_color'], 'text-'.'label_color_' . $idLayoutData, '', 7, 7, false, '', 'style="visibility: hidden; width: 0px;" class="label_color"', true) .
'</span>';
@ -171,26 +176,50 @@ foreach ($layoutDatas as $layoutData) {
$table->data[$i + 2]['icon'] = '';
//Agent
if (($layoutData['type'] != ICON) && ($layoutData['type'] != LABEL)) {
$table->data[$i + 2][0] = '<a href="#" class="tip">&nbsp;<span>' . __("Type at least two characters to search.") . '</span></a>' .
html_print_input_text_extended ('agent_' . $idLayoutData, agents_get_name($layoutData['id_agent']), 'text-agent_' . $idLayoutData, '', 15, 100, false, '',
array('class' => 'text-agent', 'style' => 'background: #ffffff url(images/lightning.png) no-repeat right;'), true);
}
else {
$table->data[$i + 2][0] = '';
switch ($layoutData['type']) {
case ICON:
case LABEL:
$table->data[$i + 2][0] = '';
break;
default:
$cell_content_enterprise = false;
if (enterprise_installed()) {
$cell_content_enterprise = enterprise_visual_map_print_list_element('agent', $layoutData);
}
if ($cell_content_enterprise === false) {
$table->data[$i + 2][0] = '<a href="#" class="tip">&nbsp;<span>' . __("Type at least two characters to search.") . '</span></a>' .
html_print_input_text_extended ('agent_' . $idLayoutData, agents_get_name($layoutData['id_agent']), 'text-agent_' . $idLayoutData, '', 15, 100, false, '',
array('class' => 'text-agent', 'style' => 'background: #ffffff url(images/lightning.png) no-repeat right;'), true);
}
else {
$table->data[$i + 2][0] = $cell_content_enterprise;
}
break;
}
//Modules
if (($layoutData['type'] != ICON) && ($layoutData['type'] != LABEL)) {
$modules = agents_get_modules($layoutData['id_agent']);
$modules = io_safe_output($modules);
$table->data[$i + 2][1] = html_print_select($modules,
'module_' . $idLayoutData, $layoutData['id_agente_modulo'], '', '---', 0, true);
}
else {
$table->data[$i + 2][1] = '';
//Module
switch ($layoutData['type']) {
case ICON:
case LABEL:
$table->data[$i + 2][1] = '';
break;
default:
$cell_content_enterprise = false;
if (enterprise_installed()) {
$cell_content_enterprise = enterprise_visual_map_print_list_element('module', $layoutData);
}
if ($cell_content_enterprise === false) {
$modules = agents_get_modules($layoutData['id_agent']);
$modules = io_safe_output($modules);
$table->data[$i + 2][1] = html_print_select($modules,
'module_' . $idLayoutData, $layoutData['id_agente_modulo'], '', '---', 0, true);
}
else {
$table->data[$i + 2][1] = $cell_content_enterprise;
}
break;
}
//Empty
@ -260,6 +289,7 @@ ui_require_jquery_file('autocomplete');
<script type="text/javascript">
$(document).ready (function () {
$(".label_color").attachColorPicker();
//$(".ColorPickerDivSample").css('float', 'right');
});
var idText = $("#ip_text").html();

View File

@ -25,8 +25,8 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
}
require_once ('include/functions_visual_map.php');
require_once('godmode/reporting/visual_console_builder.constans.php');
require_once($config['homedir'] . "/include/functions_agents.php");
enterprise_include_once('include/functions_visual_map.php');
$action = get_parameterBetweenListValues('action', array('new', 'save', 'edit', 'update', 'delete'), 'new');
$activeTab = get_parameterBetweenListValues('tab', array('data', 'list_elements', 'wizard', 'editor'), 'data');
@ -151,6 +151,11 @@ switch ($activeTab) {
$values['parent_item'] = get_parameter('parent_' . $id, 0);
$values['id_layout_linked'] = get_parameter('map_linked_' . $id, 0);
$values['label_color'] = get_parameter('label_color_' . $id, '#000000');
if (enterprise_installed()) {
enterprise_visual_map_update_action_from_list_elements($type, $values);
}
db_process_sql_update('tlayout_data', $values, array('id' => $id));
}
break;

View File

@ -24,7 +24,6 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
exit;
}
require_once('godmode/reporting/visual_console_builder.constans.php');
require_once ('include/functions_visual_map.php');
require_once($config['homedir'] . "/include/functions_agents.php");

View File

@ -24,13 +24,15 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
exit;
}
//Fix ajax to avoid include the file, 'functions_graph.php'.
$ajax = true;
require_once('godmode/reporting/visual_console_builder.constans.php');
require_once('include/functions_visual_map.php');
require_once($config['homedir'] . "/include/functions_agents.php");
require_once($config['homedir'] . '/include/functions_graph.php');
enterprise_include_once('include/functions_visual_map.php');
$action = get_parameter('action');
$type = get_parameter('type');
@ -233,6 +235,7 @@ switch ($action) {
case 'module_graph':
case 'label':
case 'icon':
default:
if ($label !== null) {
$values['label'] = $label;
}
@ -307,6 +310,11 @@ switch ($action) {
$values['height'] = $height;
}
break;
default:
if (enterprise_installed()) {
enterprise_ajax_update_values($action, $type, $values);
}
break;
}
if ($action == 'move') {
@ -371,7 +379,7 @@ switch ($action) {
break;
}
//Support for max, min and svg process on simple value items
if ($type == 'simple_value'){
if ($type == 'simple_value') {
switch ($elementFields['type']) {
case SIMPLE_VALUE:
$elementFields['process_value'] = 0;
@ -390,6 +398,9 @@ switch ($action) {
$elementFields['label'] = io_safe_output($elementFields['label']);
echo json_encode($elementFields);
break;
default:
enterprise_hook("enterprise_ajax_load_values", array($type, $id_element));
break;
}
break;
case 'insert':
@ -447,6 +458,11 @@ switch ($action) {
$values['width'] = $width;
$values['height'] = $height;
break;
default:
if (enterprise_installed()) {
enterprise_ajax_insert_fill_values_insert($type, $values);
}
break;
}
$idData = db_process_sql_insert('tlayout_data', $values);

View File

@ -21,15 +21,21 @@
/* Enterprise hook constant */
define ('ENTERPRISE_NOT_HOOK', -1);
/* Events state constants */
define ('EVENT_NEW', 0);
define ('EVENT_VALIDATE', 1);
define ('EVENT_PROCESS', 2);
/* Agents disabled status */
define ('AGENT_ENABLED',0);
define ('AGENT_DISABLED',1);
/* Error report codes */
define ('NOERR',11111);
define ('ERR_GENERIC',-10000);
@ -43,10 +49,7 @@ define ('ERR_NOCHANGES', -60000);
define ('ERR_NODATA', -70000);
define ('ERR_CONNECTION', -80000);
/* Visual console constants */
define('MIN_WIDTH',300);
define('MIN_HEIGHT',120);
define('MIN_WIDTH_CAPTION',420);
/* Seconds in a time unit constants */
define('SECONDS_1MINUTE',60);
@ -65,12 +68,16 @@ define('SECONDS_1YEAR',31104000);
define('SECONDS_2YEARS',62208000);
define('SECONDS_3YEARS',93312000);
/* Separator constats */
define('SEPARATOR_COLUMN', ';');
define('SEPARATOR_ROW', chr(10)); //chr(10) = '\n'
define('SEPARATOR_COLUMN_CSV', "#");
define('SEPARATOR_ROW_CSV', "@\n");
/* Backup paths */
switch ($config["dbtype"]) {
case "mysql":
@ -84,6 +91,8 @@ switch ($config["dbtype"]) {
break;
}
/* Color constants */
define('COL_CRITICAL','#cc0000');
define('COL_WARNING','#ffcc00');
@ -92,7 +101,34 @@ define('COL_NOTINIT','#ef2929');
define('COL_UNKNOWN','#aaaaaa');
define('COL_ALERTFIRED','#ff8800');
/* The styles */
/* Size of text in characters for truncate */
define('GENERIC_SIZE_TEXT', 25);
?>
/* Visual maps contants */
//The items kind
define('STATIC_GRAPH', 0);
define('PERCENTILE_BAR', 3);
define('MODULE_GRAPH', 1);
define('SIMPLE_VALUE', 2);
define('LABEL', 4);
define('ICON', 5);
define('SIMPLE_VALUE_MAX', 6);
define('SIMPLE_VALUE_MIN', 7);
define('SIMPLE_VALUE_AVG', 8);
define('PERCENTILE_BUBBLE', 9);
define('SERVICE', 10); //Enterprise Item.
//Some styles
define('MIN_WIDTH',300);
define('MIN_HEIGHT',120);
define('MIN_WIDTH_CAPTION',420);
//The process for simple value
define('PROCESS_VALUE_NONE', 0);
define('PROCESS_VALUE_MIN', 1);
define('PROCESS_VALUE_MAX', 2);
define('PROCESS_VALUE_AVG', 3);
?>

View File

@ -199,7 +199,8 @@ function list_files ($directory, $stringSearch, $searchHandler, $return = false)
}
if (($errorHandler == true) && (@count ($result) === 0)) {
echo ("<pre>\nerror: no filetype \"$fileExtension\" found!\n</pre>\n");
} else {
}
else {
asort ($result);
if ($return === false) {
echo ("<pre>\n");
@ -237,6 +238,7 @@ function format_numeric ($number, $decimals = 1) {
/* If has decimals */
if (fmod ($number, 1) > 0)
return number_format ($number, $decimals, $dec_point, $thousands_sep);
return number_format ($number, 0, $dec_point, $thousands_sep);
}
@ -944,8 +946,10 @@ function enterprise_hook ($function_name, $parameters = false) {
if (function_exists ($function_name)) {
if (!is_array ($parameters))
return call_user_func ($function_name);
return call_user_func_array ($function_name, $parameters);
}
return ENTERPRISE_NOT_HOOK;
}
@ -954,17 +958,22 @@ function enterprise_hook ($function_name, $parameters = false) {
*/
function enterprise_include ($filename) {
global $config;
// Load enterprise extensions
$filepath = realpath ($config["homedir"].'/'.ENTERPRISE_DIR.'/'.$filename);
if ($filepath === false)
return ENTERPRISE_NOT_HOOK;
if (strncmp ($config["homedir"], $filepath, strlen ($config["homedir"])) != 0){
return ENTERPRISE_NOT_HOOK;
}
if (file_exists ($filepath)) {
include ($filepath);
return true;
}
return ENTERPRISE_NOT_HOOK;
}
@ -1037,7 +1046,7 @@ if (!function_exists ("mb_strtoupper")) {
*/
function safe_sql_string($string) {
global $config;
switch ($config["dbtype"]) {
case "mysql":
return mysql_safe_sql_string($string);

View File

@ -265,13 +265,14 @@ function html_print_select ($fields, $name, $selected = '', $script = '', $nothi
$multiple = false, $sort = true, $class = '', $disabled = false, $style = false, $option_style = false, $size = false) {
$output = "\n";
static $idcounter = array ();
//If duplicate names exist, it will start numbering. Otherwise it won't
if (isset ($idcounter[$name])) {
$idcounter[$name]++;
} else {
}
else {
$idcounter[$name] = 0;
}
@ -308,7 +309,7 @@ function html_print_select ($fields, $name, $selected = '', $script = '', $nothi
if ($nothing != '' || empty ($fields)) {
if ($nothing == '') {
$nothing = __('None');
}
}
$output .= '<option value="'.$nothing_value.'"';
if ($nothing_value == $selected) {
$output .= ' selected="selected"';
@ -362,12 +363,12 @@ function html_print_select ($fields, $name, $selected = '', $script = '', $nothi
$output .= '</optgroup>';
}
}
$output .= "</select>";
if ($return)
return $output;
echo $output;
}
@ -394,7 +395,8 @@ function html_print_select ($fields, $name, $selected = '', $script = '', $nothi
*
* @return string HTML code if return parameter is true.
*/
function html_print_select_from_sql ($sql, $name, $selected = '', $script = '', $nothing = '', $nothing_value = '0', $return = false,
function html_print_select_from_sql ($sql, $name, $selected = '',
$script = '', $nothing = '', $nothing_value = '0', $return = false,
$multiple = false, $sort = true, $disabled = false, $style = false, $size = false, $trucate_size = GENERIC_SIZE_TEXT) {
global $config;
@ -406,10 +408,13 @@ function html_print_select_from_sql ($sql, $name, $selected = '', $script = '',
foreach ($result as $row) {
$id = array_shift($row);
$value = array_shift($row);
$fields[$id] = ui_print_truncate_text($value, $trucate_size, false, true, false);
$fields[$id] = ui_print_truncate_text(
$value, $trucate_size, false, true, false);
}
return html_print_select ($fields, $name, $selected, $script, $nothing, $nothing_value, $return, $multiple, $sort,'',$disabled, $style,'', $size);
return html_print_select ($fields, $name, $selected, $script,
$nothing, $nothing_value, $return, $multiple, $sort, '',
$disabled, $style,'', $size);
}
/**
@ -596,7 +601,7 @@ function html_print_input_text_extended ($name, $value, $id, $alt, $size, $maxle
*/
function html_print_input_password ($name, $value, $alt = '', $size = 50, $maxlength = 255, $return = false, $disabled = false) {
$output = html_print_input_text_extended ($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', '', true, true);
if ($return)
return $output;
echo $output;
@ -730,7 +735,7 @@ function html_print_submit_button ($label = 'OK', $name = '', $disabled = false,
$attributes .= $attribute.'="'.$value.'" ';
}
}
$output = '<input type="submit" id="submit-'.$name.'" name="'.$name.'" value="'. $label .'" '. $attributes;
if ($disabled)
$output .= ' disabled="disabled"';
@ -836,7 +841,7 @@ function html_print_textarea ($name, $rows, $columns, $value = '', $attributes =
function html_print_table (&$table, $return = false) {
$output = '';
static $table_count = 0;
$table_count++;
if (isset ($table->align)) {
foreach ($table->align as $key => $aa) {
@ -1197,7 +1202,7 @@ function html_print_image ($src, $return = false, $options = false, $return_src
$isFunctionSkins = enterprise_include_once ('include/functions_skins.php');
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
$skin_path = enterprise_hook('skins_get_image_path',array($src));
$skin_path = enterprise_hook('skins_get_image_path', array($src));
if ($skin_path)
$src = $skin_path;
}
@ -1230,7 +1235,7 @@ function html_print_image ($src, $return = false, $options = false, $return_src
if (isset ($options["border"])) {
$style .= 'border:'.$options["border"].'px;'; //Border is deprecated, use styles
}
if (isset ($options["hspace"])) {
$style .= 'margin-left:'.$options["hspace"].'px;'; //hspace is deprecated, use styles
$style .= 'margin-right:'.$options["hspace"].'px;';
@ -1244,22 +1249,24 @@ function html_print_image ($src, $return = false, $options = false, $return_src
$style .= 'margin-top:'.$options["vspace"].'px;'; //hspace is deprecated, use styles
$style .= 'margin-bottom:'.$options["vspace"].'px;';
}
if (isset ($options["style"])) {
$style .= $options["style"];
}
//Valid attributes (invalid attributes get skipped)
$attrs = array ("height", "longdesc", "usemap","width","id","class","title","lang","xml:lang",
"onclick", "ondblclick", "onmousedown", "onmouseup", "onmouseover", "onmousemove",
"onmouseout", "onkeypress", "onkeydown", "onkeyup","pos_tree");
$attrs = array ("height", "longdesc", "usemap","width","id",
"class","title","lang","xml:lang", "onclick", "ondblclick",
"onmousedown", "onmouseup", "onmouseover", "onmousemove",
"onmouseout", "onkeypress", "onkeydown", "onkeyup","pos_tree");
foreach ($attrs as $attribute) {
if (isset ($options[$attribute])) {
$output .= $attribute.'="'.io_safe_input_html ($options[$attribute]).'" ';
}
}
} else {
}
else {
$options = array ();
}
@ -1268,12 +1275,12 @@ function html_print_image ($src, $return = false, $options = false, $return_src
}// elseif (!isset ($options["alt"])) {
// $options["alt"] = "";
//}
if (!empty ($style)) {
$output .= 'style="'.$style.'" ';
}
if (isset($options["alt"]))
if (isset($options["alt"]))
$output .= 'alt="'.io_safe_input_html ($options['alt']).'" />';
else
$output .= '/>';

View File

@ -993,8 +993,47 @@ function ui_require_javascript_file ($name, $path = 'include/javascript/') {
if (! isset ($config['js']))
$config['js'] = array ();
if (isset ($config['js'][$name]))
return true;
/* We checks two paths because it may fails on enterprise */
if (! file_exists ($filename) && ! file_exists ($config['homedir'].'/'.$filename))
return false;
$config['js'][$name] = $filename;
return true;
}
/**
* Add a enteprise javascript file to the HTML head tag.
*
* To make a javascript file available just put it in <ENTERPRISE_DIR>/include/javascript. The
* file name should be like "name.js". The "name" would be the value
* needed to pass to this function.
*
* @param string Script name to add without the "jquery." prefix and the ".js"
* suffix. Example:
* <code>
* ui_require_javascript_file ('pandora');
* // Would include include/javascript/pandora.js
* </code>
*
* @return bool True if the file was added. False if the file doesn't exist.
*/
function ui_require_javascript_file_enterprise($name) {
global $config;
$filename = ENTERPRISE_DIR . '/include/javascript/' .$name.'.js';
if (! isset ($config['js']))
$config['js'] = array ();
if (isset ($config['js'][$name]))
return true;
/* We checks two paths because it may fails on enterprise */
if (! file_exists ($filename) && ! file_exists ($config['homedir'].'/'.$filename))
return false;

View File

@ -47,34 +47,6 @@ function visual_map_print_item_toolbox($idDiv, $text, $float) {
echo '</div>';
}
function visual_map_print_button_editor($idDiv, $label, $float = 'left', $disabled = false, $class= '', $imageButton = false) {
if ($float == 'left') {
$margin = 'margin-right';
}
else {
$margin = 'margin-left';
}
html_print_button($label, 'button_toolbox2', $disabled, "click_button_toolbox('" . $idDiv . "');", 'class="sub ' . $idDiv . ' ' . $class . '" style="float: ' . $float . ';"', false, $imageButton);
return;
if (!$disabled) $disableClass = '';
else $disableClass = 'disabled';
echo '<div class="button_toolbox ' . $disableClass . '" id="' . $idDiv . '"
style="font-weight: bolder; text-align: center; float: ' . $float . ';' .
'width: 80px; height: 50px; background: #e5e5e5; border: 4px outset black; ' . $margin . ': 5px;">';
if ($disabled) {
echo '<span class="label" style="color: #aaaaaa;">';
}
else {
echo '<span class="label" style="color: #000000;">';
}
echo $label;
echo '</span>';
echo '</div>';
}
function visual_map_print_item($layoutData) {
global $config;
@ -97,39 +69,7 @@ function visual_map_print_item($layoutData) {
$text = '<span id="text_' . $id . '" class="text">' . $label . '</span>';
// Linked to other layout ?? - Only if not module defined
if ($layoutData['id_layout_linked'] != 0) {
$status = visual_map_get_layout_status ($layoutData['id_layout_linked']);
// Single object
}
elseif (($layoutData["type"] == 0)
|| ($layoutData["type"] == 3)
|| ($layoutData["type"] == 4)) {
// Status for a simple module
if ($layoutData['id_agente_modulo'] != 0) {
$status = modules_get_agentmodule_status ($layoutData['id_agente_modulo']);
$id_agent = db_get_value ("id_agente", "tagente_estado", "id_agente_modulo", $layoutData['id_agente_modulo']);
// Status for a whole agent, if agente_modulo was == 0
}
elseif ($layoutData['id_agent'] != 0) {
$status = agents_get_status ($layoutData["id_agent"]);
if ($status == -1) // agents_get_status return -1 for unknown!
$status = 3;
$id_agent = $layoutData["id_agent"];
}
else {
$status = 3;
$id_agent = 0;
}
}
else {
// If it's a graph, a progress bar or a data tag, ALWAYS report
// status OK (=0) to avoid confussions here.
$status = 0;
}
$status = visual_map_get_status_element($layoutData);
switch ($status) {
case 1:
//Critical (BAD)
@ -163,13 +103,13 @@ function visual_map_print_item($layoutData) {
$borderStyle ='border: 2px solid #ffa300;';
$img = substr_replace($img, '', 0,1);
}
$imgSizes = getimagesize($img);
}
if (($width != 0) && ($height != 0)) {
$sizeStyle = 'width: ' . $width . 'px; height: ' . $height . 'px;';
$imageSize = 'width="' . $width . '" height="' . $height . '"';
}
echo '<div id="' . $id . '" class="item static_graph" style="text-align: center; color: ' . $color . '; position: absolute; display: inline-block; ' . $sizeStyle . ' top: ' . $top . 'px; left: ' . $left . 'px;">';
echo '<div id="' . $id . '" class="item static_graph" style="z-index: 1; text-align: center; color: ' . $color . '; position: absolute; display: inline-block; ' . $sizeStyle . ' top: ' . $top . 'px; left: ' . $left . 'px;">';
if ($layoutData['image'] != null) {
if (($width != 0) && ($height != 0))
echo html_print_image($img, true, array("class" => "image", "id" => "image_" . $id, "width" => "$width", "height" => "$height", "style" => $borderStyle));
@ -201,7 +141,7 @@ function visual_map_print_item($layoutData) {
else
$percentile = 100;
echo '<div id="' . $id . '" class="item percentile_item" style="color: ' . $color . '; text-align: center; position: absolute; display: inline-block; ' . $sizeStyle . ' top: ' . $top . 'px; left: ' . $left . 'px;">';
echo '<div id="' . $id . '" class="item percentile_item" style="z-index: 1; color: ' . $color . '; text-align: center; position: absolute; display: inline-block; ' . $sizeStyle . ' top: ' . $top . 'px; left: ' . $left . 'px;">';
echo $text . '<br />';
ob_start();
@ -222,7 +162,7 @@ function visual_map_print_item($layoutData) {
$height, '', null, false, 1, false, 0, '', 0, 0, true, true);
$img = str_replace('>', 'class="image" id="image_' . $id . '" />', $img);
echo '<div id="' . $id . '" class="item module_graph" style="color: ' . $color . '; text-align: center; position: absolute; display: inline-block; ' . $sizeStyle . ' top: ' . $top . 'px; left: ' . $left . 'px;">';
echo '<div id="' . $id . '" class="item module_graph" style="z-index: 1; color: ' . $color . '; text-align: center; position: absolute; display: inline-block; ' . $sizeStyle . ' top: ' . $top . 'px; left: ' . $left . 'px;">';
echo $text . '<br />';
echo $img;
echo '</div>';
@ -231,27 +171,27 @@ function visual_map_print_item($layoutData) {
case SIMPLE_VALUE_MAX:
case SIMPLE_VALUE_MIN:
case SIMPLE_VALUE_AVG:
echo '<div id="' . $id . '" class="item simple_value" style="left: 0px; top: 0px; color: ' . $color . '; text-align: center; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
echo '<div id="' . $id . '" class="item simple_value" style="z-index: 1; left: 0px; top: 0px; color: ' . $color . '; text-align: center; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
echo $text;
$value = visual_map_get_simple_value($type, $id_module, $period);
echo ' <span id="simplevalue_' . $id . '" style="font-weight:bold;">' . $value . '</span>';
echo '</div>';
break;
case LABEL:
echo '<div id="' . $id . '" class="item label" style="left: 0px; top: 0px; text-align: center; color: ' . $color . '; position: absolute; display: inline-block; ' . $sizeStyle . ' top: ' . $top . 'px; left: ' . $left . 'px;">';
echo '<div id="' . $id . '" class="item label" style="z-index: 1; left: 0px; top: 0px; text-align: center; color: ' . $color . '; position: absolute; display: inline-block; ' . $sizeStyle . ' top: ' . $top . 'px; left: ' . $left . 'px;">';
echo $text;
echo "</div>";
break;
case ICON:
if ($layoutData['image'] != null) {
$img = visual_map_get_image_status_element($layoutData);
$imgSizes = getimagesize($img);
}
if (($width != 0) && ($height != 0)) {
$sizeStyle = 'width: ' . $width . 'px; height: ' . $height . 'px;';
$imageSize = 'width="' . $width . '" height="' . $height . '"';
}
echo '<div id="' . $id . '" class="item icon" style="left: 0px; top: 0px; text-align: center; color: ' . $color . '; position: absolute; display: inline-block; ' . $sizeStyle . ' top: ' . $top . 'px; left: ' . $left . 'px;">';
echo '<div id="' . $id . '" class="item icon" style="z-index: 1; left: 0px; top: 0px; text-align: center; color: ' . $color . '; position: absolute; display: inline-block; ' . $sizeStyle . ' top: ' . $top . 'px; left: ' . $left . 'px;">';
if ($layoutData['image'] != null) {
// If match with protocol://direction
if (preg_match('/^(http:\/\/)((.)+)$/i', $text)){
@ -266,6 +206,10 @@ function visual_map_print_item($layoutData) {
}
echo "</div>";
break;
default:
enterprise_hook("enterprise_visual_map_print_item",
array($layoutData, $status, $colorStatus));
break;
}
//Add the line between elements.
@ -744,33 +688,47 @@ function visual_map_get_image_status_element($layoutData) {
* @return integer
*/
function visual_map_get_status_element($layoutData) {
enterprise_include_once('include/functions_visual_map.php');
if (enterprise_installed()) {
$status = enterprise_visual_map_get_status_element($layoutData);
//The function return value.
if ($status !== false) {
//Return this value as call of open function.
return $status;
}
}
//Linked to other layout ?? - Only if not module defined
if ($layoutData['id_layout_linked'] != 0) {
$status = visual_map_get_layout_status ($layoutData['id_layout_linked']);
}
else if ($layoutData["type"] == 0) {
//Single object
//Status for a simple module
if ($layoutData['id_agente_modulo'] != 0) {
$status = modules_get_agentmodule_status ($layoutData['id_agente_modulo']);
//Status for a whole agent, if agente_modulo was == 0
}
else if ($layoutData['id_agent'] != 0) {
$status = agents_get_status ($layoutData["id_agent"]);
if ($status == -1) // agents_get_status return -1 for unknown!
$status = 3;
}
else {
$status = 3;
$id_agent = 0;
}
}
else {
//If it's a graph, a progress bar or a data tag, ALWAYS report status OK
//(=0) to avoid confussions here.
$status = 0;
switch ($layoutData["type"]) {
case STATIC_GRAPH:
//Status for a simple module
if ($layoutData['id_agente_modulo'] != 0) {
$status = modules_get_agentmodule_status ($layoutData['id_agente_modulo']);
//Status for a whole agent, if agente_modulo was == 0
}
else if ($layoutData['id_agent'] != 0) {
$status = agents_get_status ($layoutData["id_agent"]);
if ($status == -1) // agents_get_status return -1 for unknown!
$status = 3;
}
else {
$status = 3;
$id_agent = 0;
}
break;
default:
//If it's a graph, a progress bar or a data tag, ALWAYS report status OK
//(=0) to avoid confussions here.
$status = 0;
break;
}
}
return $status;

View File

@ -0,0 +1,344 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// 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.
/**
* @package Include
* @subpackage Reporting
*/
function visual_map_editor_print_item_palette($visualConsole_id, $background) {
global $config;
$images_list = array ();
$all_images = list_files ('images/console/icons/', "png", 1, 0);
foreach ($all_images as $image_file) {
if (strpos ($image_file, "_bad"))
continue;
if (strpos ($image_file, "_ok"))
continue;
if (strpos ($image_file, "_warning"))
continue;
$image_file = substr ($image_file, 0, strlen ($image_file) - 4);
$images_list[$image_file] = $image_file;
}
//Arrays for select box.
$backgrounds_list = list_files('images/console/background/', "jpg", 1, 0);
$backgrounds_list = array_merge($backgrounds_list, list_files ('images/console/background/', "png", 1, 0));
echo '<div id="properties_panel" style="display: none; position: absolute; border: 2px solid #114105; padding: 5px; background: white; z-index: 90;">';
//----------------------------Hiden Form----------------------------------------
?>
<table class="databox" border="0" cellpadding="4" cellspacing="4" width="300">
<caption>
<?php
$titles = array(
'background' => __('Background'),
'static_graph' => __('Static Graph'),
'percentile_item' => __('Percentile Item'),
'module_graph' => __('Module Graph'),
'module_graph' => __('Module Graph'),
'simple_value' => __('Simple value'),
'label' => __('Label'),
'icon' => __('Icon'));
if (enterprise_installed()) {
enterprise_visual_map_editor_add_title_palette($titles);
}
foreach ($titles as $item => $title) {
echo '<span id="title_panel_span_' . $item . '"
class="title_panel_span"
style="display: none; font-weight: bolder;">' .
$title . '</span>';
}
?>
</caption>
<tbody>
<?php
$form_items = array();
$form_items['label_row'] = array();
$form_items['label_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'label', 'datos'. 'icon');
$form_items['label_row']['html'] = '<td style="">' . __('Label') .'</td>
<td style="">'. html_print_input_text ('label', '', '', 20, 200, true) .'</td>';
$form_items['image_row'] = array();
$form_items['image_row']['items'] = array('static_graph', 'icon', 'datos');
$form_items['image_row']['html'] = '<td>' . __('Image') . '</td>
<td>'. html_print_select ($images_list, 'image', '', 'showPreview(this.value);', 'None', '', true) .'</td>';
$form_items['preview_row'] = array();
$form_items['preview_row']['items'] = array('static_graph', 'datos icon');
$form_items['preview_row']['html'] = '<td colspan="2" style="text-align: right;"><div id="preview" style="text-align: right;"></div></td>';
$form_items['agent_row'] = array();
$form_items['agent_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'datos');
$form_items['agent_row']['html'] = '<td>' . __('Agent') .
'<a href="#" class="tip">&nbsp;<span>' . __("Type at least two characters to search.") . '</span></a>' . '</td>
<td>' . html_print_input_text_extended ('agent', '', 'text-agent', '', 25, 100, false, '',
array('style' => 'background: #ffffff url(images/lightning.png) no-repeat right;'), true) . '</td>';
$form_items['module_row'] = array();
$form_items['module_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'datos');
$form_items['module_row']['html'] = '<td>' . __('Module') . '</td>
<td>'. html_print_select (array(), 'module', '', '', __('Any'), 0, true) . '</td>';
$form_items['process_value_row'] = array();
$form_items['process_value_row']['items'] = array('simple_value', 'datos');
$form_items['process_value_row']['html'] = '<td><span>' . __('Process') . '</span></td>
<td>'. html_print_select (
array (PROCESS_VALUE_MIN => __('Min value'),
PROCESS_VALUE_MAX => __('Max value'),
PROCESS_VALUE_AVG => __('Avg value')),
'process_value', '', '', __('None'), PROCESS_VALUE_NONE, true) . '</td>';
$form_items['background_row_1'] = array();
$form_items['background_row_1']['items'] = array('background', 'datos');
$form_items['background_row_1']['html'] = '<td>' . __('Background') . '</td>
<td>' . html_print_select($backgrounds_list, 'background_image', $background, '', 'None', '', true) . '</td>';
$form_items['background_row_2'] = array();
$form_items['background_row_2']['items'] = array('background', 'datos');
$form_items['background_row_2']['html'] = '<td>' . __('Original Size') . '</td>
<td>' . html_print_button(__('Apply'), 'original_false', false, "setAspectRatioBackground('original')", 'class="sub"', true) . '</td>';
$form_items['background_row_3'] = array();
$form_items['background_row_3']['items'] = array('background', 'datos');
$form_items['background_row_3']['html'] = '<td>' . __('Aspect ratio') . '</td>
<td>' . html_print_button(__('Width proportional'), 'original_false', false, "setAspectRatioBackground('width')", 'class="sub"', true) . '</td>';
$form_items['background_row_4'] = array();
$form_items['background_row_4']['items'] = array('background', 'datos');
$form_items['background_row_4']['html'] = '<td></td>
<td>' . html_print_button(__('Height proportional'), 'original_false', false, "setAspectRatioBackground('height')", 'class="sub"', true) . '</td>';
$form_items['percentile_bar_row_1'] = array();
$form_items['percentile_bar_row_1']['items'] = array('percentile_bar', 'percentile_item', 'datos');
$form_items['percentile_bar_row_1']['html'] = '<td>' . __('Width') . '</td>
<td>' . html_print_input_text('width_percentile', 0, '', 3, 5, true) . '</td>';
$form_items['percentile_bar_row_2'] = array();
$form_items['percentile_bar_row_2']['items'] = array('percentile_bar', 'percentile_item', 'datos');
$form_items['percentile_bar_row_2']['html'] = '<td>' . __('Max value') . '</td>
<td>' . html_print_input_text('max_percentile', 0, '', 3, 5, true) . '</td>';
$form_items['percentile_item_row_3'] = array();
$form_items['percentile_item_row_3']['items'] = array('percentile_bar', 'percentile_item', 'datos');
$form_items['percentile_item_row_3']['html'] = '<td>' . __('Type') . '</td>
<td>' .
html_print_radio_button_extended('type_percentile', 'percentile', ('Percentile'), 'percentile', false, '', 'style="float: left;"', true) .
html_print_radio_button_extended('type_percentile', 'bubble', ('Bubble'), 'percentile', false, '', 'style="float: left;"', true) .
'</td>';
$form_items['percentile_item_row_4'] = array();
$form_items['percentile_item_row_4']['items'] = array('percentile_bar', 'percentile_item', 'datos');
$form_items['percentile_item_row_4']['html'] = '<td>' . __('Value to show') . '</td>
<td>' .
html_print_radio_button_extended('value_show', 'percent', ('Percent'), 'value', false, '', 'style="float: left;"', true) .
html_print_radio_button_extended('value_show', 'value', ('Value'), 'value', false, '', 'style="float: left;"', true) .
'</td>';
$form_items['period_row'] = array();
$form_items['period_row']['items'] = array('module_graph', 'simple_value', 'datos');
$form_items['period_row']['html'] = '<td>' . __('Period') . '</td>
<td>' . html_print_extended_select_for_time ('period', '', '', '', '', false, true) . '</td>';
$form_items['module_graph_size_row'] = array();
$form_items['module_graph_size_row']['items'] = array('module_graph', 'datos');
$form_items['module_graph_size_row']['html'] = '<td>' . __('Size') . '</td>
<td>' .
html_print_input_text('width_module_graph', 300, '', 3, 5, true) .
' X ' .
html_print_input_text('height_module_graph', 180, '', 3, 5, true) .
'</td>';
//Insert and modify before the buttons to create or update.
if (enterprise_installed()) {
enterprise_visual_map_editor_modify_form_items_palette($form_items);
}
$form_items['button_update_row'] = array();
$form_items['button_update_row']['items'] = array('datos');
$form_items['button_update_row']['html'] = '<td colspan="2" style="text-align: right;">' .
html_print_button(__('Cancel'), 'cancel_button', false, 'cancel_button_palette_callback();', 'class="sub cancel"', true) .
html_print_button(__('Update'), 'update_button', false, 'update_button_palette_callback();', 'class="sub upd"', true) .
'</td>';
$form_items['button_create_row'] = array();
$form_items['button_create_row']['items'] = array('datos');
$form_items['button_create_row']['html'] = '<td colspan="2" style="text-align: right;">' .
html_print_button(__('Cancel'), 'cancel_button', false, 'cancel_button_palette_callback();', 'class="sub cancel"', true) .
html_print_button(__('Create'), 'create_button', false, 'create_button_palette_callback();', 'class="sub wand"', true) .
'</td>';
foreach ($form_items as $item => $item_options) {
echo '<tr id="' . $item . '" style="" class="' . implode(' ', $item_options['items']) . '">';
echo $item_options['html'];
echo '</tr>';
}
?>
<tr id="advance_options_link" class="datos">
<td colspan="2" style="text-align: center;">
<a href="javascript: toggle_advance_options_palette()"><?php echo __('Advanced options');?></a>
</td>
</tr>
</tbody>
<tbody id="advance_options" style="display: none;">
<?php
$form_items_advance = array();
$form_items_advance['position_row'] = array();
$form_items_advance['position_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'label', 'icon', 'datos');
$form_items_advance['position_row']['html'] = '
<td>' . __('Position') . '</td>
<td>(' . html_print_input_text('left', '0', '', 3, 5, true) .
' , ' .
html_print_input_text('top', '0', '', 3, 5, true) .
')</td>';
$form_items_advance['size_row'] = array();
$form_items_advance['size_row']['items'] = array('background',
'static_graph', 'icon datos');
$form_items_advance['size_row']['html'] = '<td>' .
__('Size') . '<a href="#" class="tip">&nbsp;<span>' .
__("For use the original image file size, set 0 width and 0 height.") .
'</span></a>' . '</td>
<td>' . html_print_input_text('width', 0, '', 3, 5, true) .
' X ' .
html_print_input_text('height', 0, '', 3, 5, true) .
'</td>';
$parents = visual_map_get_items_parents($visualConsole_id);
$form_items_advance['parent_row'] = array();
$form_items_advance['parent_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'label', 'icon', 'datos');
$form_items_advance['parent_row']['html'] = '<td>' .
__('Parent') . '</td>
<td>' .
html_print_select($parents, 'parent', '', '', __('None'), 0, true) .
'</td>';
$form_items_advance['map_linked_row'] = array();
$form_items_advance['map_linked_row']['items'] = array(
'static_graph', 'percentile_bar', 'percentile_item',
'module_graph', 'simple_value', 'icon', 'label', 'datos');
$form_items_advance['map_linked_row']['html'] = '<td>'.
__('Map linked') . '</td>' .
'<td>' . html_print_select_from_sql (
'SELECT id, name
FROM tlayout
WHERE id != ' . $visualConsole_id, 'map_linked', '', '', 'None', '0', true) .
'</td>';
$form_items_advance['label_color_row'] = array();
$form_items_advance['label_color_row']['items'] = array(
'static_graph', 'percentile_bar', 'percentile_item',
'module_graph', 'simple_value', 'label', 'datos');
$form_items_advance['label_color_row']['html'] = '<td>' .
__('Label color') . '</td>
<td>' . html_print_input_text_extended ('label_color', '#000000', 'text-'.'label_color', '', 7, 7, false, '', 'class="label_color"', true) .
'</td>';
//Insert and modify before the buttons to create or update.
if (enterprise_installed()) {
enterprise_visual_map_editor_modify_form_items_advance_palette($form_items_advance);
}
foreach ($form_items_advance as $item => $item_options) {
echo '<tr id="' . $item . '" style="" class="' . implode(' ', $item_options['items']) . '">';
echo $item_options['html'];
echo '</tr>';
}
?>
</tbody>
</table>
<?php
//------------------------------------------------------------------------------
echo '</div>';
}
function visual_map_editor_print_toolbox() {
global $config;
echo '<div id="editor" style="margin-top: -10px;">';
echo '<div id="toolbox">';
visual_map_print_button_editor('static_graph', __('Static Graph'), 'left', false, 'camera_min', true);
visual_map_print_button_editor('percentile_item', __('Percentile Item'), 'left', false, 'percentile_item_min', true);
visual_map_print_button_editor('module_graph', __('Module Graph'), 'left', false, 'graph_min', true);
visual_map_print_button_editor('simple_value', __('Simple Value'), 'left', false, 'binary_min', true);
visual_map_print_button_editor('label', __('Label'), 'left', false, 'label_min', true);
visual_map_print_button_editor('icon', __('Icon'), 'left', false, 'icon_min', true);
enterprise_hook("enterprise_visual_map_editor_print_toolbox");
visual_map_print_button_editor('save', __('Save'), 'right', true, 'save_min', true);
$text_autosave = __('Auto Save') . html_print_checkbox('auto_save', 0, true, true, false, "click_button_toolbox('auto_save');");
visual_map_print_item_toolbox('auto_save', $text_autosave, 'right');
visual_map_print_button_editor('show_grid', __('Show grid'), 'right', true, 'grid_min', true);
visual_map_print_button_editor('edit_item', __('Update item'), 'right', true, 'config_min', true);
visual_map_print_button_editor('delete_item', __('Delete item'), 'right', true, 'delete_min', true);
echo '</div>';
echo '</div>';
echo '<div style="clear: right; margin-bottom: 10px;"></div>';
}
function visual_map_print_button_editor($idDiv, $label, $float = 'left', $disabled = false, $class= '', $imageButton = false) {
if ($float == 'left') {
$margin = 'margin-right';
}
else {
$margin = 'margin-left';
}
html_print_button($label, 'button_toolbox2', $disabled,
"click_button_toolbox('" . $idDiv . "');",
'class="sub visual_editor_button_toolbox ' . $idDiv . ' ' . $class . '" style="float: ' . $float . ';"', false, $imageButton);
}
function visual_map_editor_print_hack_translate_strings() {
//Trick for it have a traduct text for javascript.
echo '<span id="any_text" style="display: none;">' . __('Any') . '</span>';
echo '<span id="ip_text" style="display: none;">' . __('IP') . '</span>';
//Hack to translate messages in javascript
echo '<span style="display: none" id="message_alert_no_label_no_image">' . __('No image or name defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_label">' . __('No label defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_image">' . __('No image defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_process">' . __('No process defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_max_percentile">' . __('No Max value defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_width_percentile">' . __('No width defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_period">' . __('No period defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_agent">' . __('No agent defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_module">' . __('No module defined.') .'</span>';
echo '<span style="display: none" id="hack_translation_correct_save">' . __('Successfully save the changes.') .'</span>';
echo '<span style="display: none" id="hack_translation_incorrect_save">' . __('Could not be save') .'</span>';
}
?>

View File

@ -49,11 +49,11 @@ div#main {
/* Set rules to fill background */
min-height: 100%;
min-width: 1024px;
/* Set up proportionate scaling */
width: 100%;
height: auto;
/* Set up positioning */
position: fixed;
top: 0;
@ -157,7 +157,7 @@ p.center {
h1#log {
font-size: 18px;
margin-bottom: 0px;
color: #000;
color: #000;
}
h1#log_f {
color: #c00;
@ -364,15 +364,13 @@ input.sub[disabled] {
color: #aaa;
}
input.next, input.upd, input.ok, input.wand, input.delete, input.cog, input.target, input.search,
input.copy, input.add, input.graph, input.percentile, input.binary,
input.camera, input.config, input.cancel {
input.next, input.upd, input.ok, input.wand, input.delete, input.cog,
input.target, input.search, input.copy, input.add, input.graph,
input.percentile, input.binary, input.camera, input.config,
input.cancel {
padding-right: 21px;
}
input.delete_min, input.graph_min, input.percentile_min, input.percentile_item_min, input.binary_min,
input.camera_min, input.config_min, input.label_min, input.icon_min, input.grid_min, input.save {
padding-right: 25px;
}
input.next {
background: #e5e5e5 url(../../images/go.png) no-repeat 98% 2px;
}
@ -421,6 +419,14 @@ input.camera {
input.config {
background: #e5e5e5 url(../../images/config.png) no-repeat 98% 3px;
}
#toolbox {
margin-top: 10px;
}
input.visual_editor_button_toolbox {
padding-right: 25px;
}
input.delete_min {
background: #e5e5e5 url(../../images/cross.png) no-repeat center;
}
@ -478,18 +484,25 @@ input.icon_min[disabled] {
input.grid_min {
background: #e5e5e5 url(../../images/grid.png) no-repeat center;
}
input.grid_min[disabled] {
background: #e5e5e5 url(../../images/grid.disabled.png) no-repeat center;
}
input.save_min {
background: #e5e5e5 url(../../images/file.png) no-repeat center;
}
input.save_min[disabled] {
background: #e5e5e5 url(../../images/file.disabled.png) no-repeat center;
}
input.grid_min[disabled] {
background: #e5e5e5 url(../../images/grid.disabled.png) no-repeat center;
input.service_min {
background: #e5e5e5 url(../../images/sitemap_color.png) no-repeat center;
}
#toolbox {
margin-top: 10px;
input.service_min[disabled] {
background: #e5e5e5 url(../../images/sitemap.png) no-repeat center;
}
table, img {
border: 0px;
}
@ -569,7 +582,8 @@ tr.rowOdd:hover {
font-size: 7pt;
text-align: center;
}
.f9, .f9i, .f9b, .datos_greyf9, .datos_bluef9, .datos_greenf9, .datos_redf9, .datos_yellowf9, td.f9, td.f9i, td.datosf9, td.datos2f9 {
.f9, .f9i, .f9b, .datos_greyf9, .datos_bluef9, .datos_greenf9,
.datos_redf9, .datos_yellowf9, td.f9, td.f9i, td.datosf9, td.datos2f9 {
font-size: 6.5pt;
}
.f9i, .redi {
@ -917,7 +931,7 @@ span.rmess, span.nrmess {
#head_m {
position: absolute;
padding-top: 6px;
padding-left: 12em;
padding-left: 12em;
}
span#logo_text1 {
font: bolder 3em Arial, Sans-serif;
@ -1654,7 +1668,7 @@ td.datos_greyf9, td.datos_bluef9, td.datos_greenf9, td.datos_redf9, td.datos_yel
}
#menu_tab li.separator {
/* Empty */
}
input#text-id_parent.ac_input, input, textarea, select {

View File

@ -211,13 +211,14 @@ elseif (! isset ($config['id_user']) && isset ($_GET["login"])) {
}
}
if (($nick_in_db !== false) && $expired_pass) { //login ok and password has expired
require_once ('general/login_page.php');
db_pandora_audit("Password expired", "Password expired: ".$nick, $nick);
while (@ob_end_flush ());
exit ("</html>");
} else if (($nick_in_db !== false) && (!$expired_pass)) { //login ok and password has not expired
}
else if (($nick_in_db !== false) && (!$expired_pass)) { //login ok and password has not expired
$process_login = true;
unset ($_GET["sec2"]);
@ -263,8 +264,8 @@ elseif (! isset ($config['id_user']) && isset ($_GET["login"])) {
$_GET["sec2"] = $res["sec2"];
break;
}
} else {
}
else {
$_GET["sec"] = "general/logon_ok";
}
}
@ -302,7 +303,6 @@ elseif (! isset ($config['id_user']) && isset ($_GET["login"])) {
while (@ob_end_flush ());
exit ("</html>");
}
}
}
elseif (! isset ($config['id_user'])) {
@ -340,7 +340,7 @@ if ($process_login) {
//Set the initial global counter for chat.
users_get_last_global_counter('session');
}
//Get old parameters before navigation.
$old_sec = '';
$old_sec2 = '';
@ -508,8 +508,8 @@ else {
}
break;
}
} else {
}
else {
require("general/logon_ok.php");
}
}