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

* extensions/update_manager/main.php, general/shortcut_bar.php,
	godmode/reporting/reporting_builder.item_editor.php,
	godmode/reporting/reporting_builder.php,
	godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
	include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
	operation/events/events_list.php, operation/netflow/nf_live_view.php:
	cleaned source code style.
	
	* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
	enterprise feature that have been wrong for years.
	
	* general/header.php: changed to load the jquery-ui and jquery javascript
	library to last version.
	
	* extensions/insert_data.php, extensions/snmp_explorer.php,
	godmode/agentes/agent_manager.php, include/ajax/agent.php,
	include/javascript/pandora.js, operation/agentes/exportdata.php,
	operation/events/events.php: changed the unknow plugin autocomplete for
	the autocomple from jquery-ui.
	
	* include/functions_ui.php: cleaned source code style and into the function
	"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
	
	* include/styles/jquery-ui-1.8.17.custom.css,
	include/javascript/jquery-1.7.1.min.js,
	include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
	version of Jquery and Jquery-ui. 
	
	Merge from the branch "pandora_4.0"
	
	* godmode/reporting/visual_console_builder.constans.php,
	godmode/reporting/visual_console_builder.editor.js,
	godmode/reporting/visual_console_builder.editor.php,
	include/functions_visual_map.php,
	include/ajax/visual_console_builder.ajax.php,
	include/javascript/pandora_visual_console.js: changed the unknow
	plugin autocomplete for the autocomple from jquery-ui and added function to
	paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
	name "progress_bubble".
	
	* images/percentile_item.disabled.png, images/percentile_item.png: added
	images for button of percentile item (new item in visual map).
	
	* include/styles/pandora.css: added the style for the new button percentile
	item.
	
	* include/functions_graph.php, include/graphs/fgraph.php,
	include/graphs/functions_gd.php: cleaned source code style, and added the
	params to set text and color in the function "progress_bar" and added
	function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
	with the name "progress_bubble".
	


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-03-05 17:56:56 +00:00
parent 2d505719a4
commit c27b9c6a22
38 changed files with 2903 additions and 976 deletions

View File

@ -1,3 +1,57 @@
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
2012-03-05 Vanessa Gil <vanessa.gil@artica.es>
* operation/search_alerts.php: Fixed sql error.

View File

@ -177,53 +177,42 @@ function mainInsertData() {
echo "</form>";
ui_require_css_file ('datepicker');
ui_require_jquery_file ('ui.core');
ui_require_jquery_file ('ui.datepicker');
ui_require_jquery_file ('timeentry');
ui_require_jquery_file ('autocomplete');
?>
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready (function () {
$("#text_id_agent").autocomplete(
"ajax.php",
{
minChars: 2,
scroll:true,
extraParams: {
$("#text_id_agent").autocomplete({
minLength: 2,
source: function( request, response ) {
var term = request.term; //Word to search
var data_params = {
page: "operation/agentes/exportdata",
search_agents: 1,
id_group: function() { return $("#id_group").val(); }
},
formatItem: function (data, i, total) {
if (total == 0)
$("#text_id_agent").css ('background-color', '#cc0000');
else
$("#text_id_agent").css ('background-color', '');
if (data == "")
return false;
return data[0]+'<br><span class="ac_extra_field"><?php echo __("IP") ?>: '+data[1]+'</span>';
},
delay: 200
}
);
$("#text-time").timeEntry ({
spinnerImage: 'images/time-entry.png',
spinnerSize: [20, 20, 0]
});
$("#text-date").datepicker ();
});
$("#text_id_agent").result (
function () {
selectAgent = true;
var agent_name = this.value;
$('#id_agent_module').fadeOut ('normal', function () {
"search_agents_2": 1,
"q": term,
id_group: function() { return $("#id_group").val(); }};
jQuery.ajax ({
data: data_params,
async: false,
type: "POST",
url: action="ajax.php",
timeout: 10000,
dataType: "json",
success: function (data) {
response(data);
return;
}
});
return;
},
select: function( event, ui ) {
var agent_name = ui.item.name;
//Put the name
$(this).val(agent_name);
$('#id_agent_module').empty ();
var inputs = [];
inputs.push ("agent_name=" + agent_name);
@ -249,11 +238,44 @@ function mainInsertData() {
$('#submit-submit').fadeIn ('normal');
}
});
});
return false;
}
})
.data( "autocomplete")._renderItem = function( ul, item ) {
if ((item.ip == "") || (typeof(item.ip) == "undefined")) {
text = "<a>" + item.name + "</a>";
}
else {
text = "<a>" + item.name
+ "<br><span style=\"font-size: 70%; font-style: italic;\">IP:" + item.ip + "</span></a>";
}
}
);
return $("<li></li>")
.data("item.autocomplete", item)
.append(text)
.appendTo(ul);
};
//Force the size of autocomplete
$(".ui-autocomplete").css("max-height", "100px");
$(".ui-autocomplete").css("overflow-y", "auto");
/* prevent horizontal scrollbar */
$(".ui-autocomplete").css("overflow-x", "hidden");
/* add padding to account for vertical scrollbar */
$(".ui-autocomplete").css("padding-right", "20px");
//Force to style of items
$(".ui-autocomplete").css("text-align", "left");
$("#text-time").timeEntry ({
spinnerImage: 'images/time-entry.png',
spinnerSize: [20, 20, 0]
});
$("#text-date").datepicker ();
});
/* ]]> */
</script>
<?php

View File

@ -397,7 +397,7 @@ function snmp_explorer() {
ui_require_jquery_file ('pandora.controls');
ui_require_jquery_file ('ajaxqueue');
ui_require_jquery_file ('bgiframe');
ui_require_jquery_file ('autocomplete');
//ui_require_jquery_file ('autocomplete');
?>
<script language="javascript" type="text/javascript">
@ -419,7 +419,7 @@ $(document).ready (function () {
}
});
$("#walk_form").submit(function(){
$("#walk_form").submit(function() {
$("#submit-snmp_walk").disable ();
$("#oid_loading").show ();
$("#no_snmp").hide ();

View File

@ -27,7 +27,7 @@ ui_print_page_header (__('Update manager'), "images/extensions.png", false, "",
if ($settings->customer_key == FREE_USER) {
echo '<div class="notify" style="width: 80%; text-align:left;" >';
echo html_print_image("images/information.png", true) . '&nbsp;';
echo html_print_image("images/information.png", true) . '&nbsp;';
/* Translators: Do not translade Update Manager, it's the name of the program */
echo __('The new <a href="http://updatemanager.sourceforge.net">Update Manager</a> client is shipped with Pandora FMS It helps system administrators to update their Pandora FMS automatically, since the Update Manager does the task of getting new modules, new plugins and new features (even full migrations tools for future versions) automatically.');
echo '<p />';

View File

@ -32,12 +32,13 @@ config_check();
<table width="100%" cellpadding="0" cellspacing="0" style="margin:0px; padding:0px; margin-top: 5px;" border="0">
<tr>
<td rowspan="2">
<a href="index.php?sec=main">
<?php
if (!defined ('PANDORA_ENTERPRISE')){
echo html_print_image('images/pandora_header_logo.png', true, array("alt" => 'Pandora FMS Opensource', "border" => '0'));
} else {
}
else {
echo html_print_image('images/pandora_header_logo_enterprise.png', true, array("alt" => 'Pandora FMS Enterprise', "border" => '0'));
}
?>
@ -49,71 +50,69 @@ config_check();
html_print_image("images/user_suit.png" , false, array("class" => 'bot', "alt" => 'user'));
else
html_print_image("images/user_green.png" , false, array("class" => 'bot', "alt" => 'user'));
?>
?>
<a href="index.php?sec=usuarios&amp;sec2=operation/users/user_edit" class="white"> [<b><?php echo $config["id_user"];?></b>]</a>
<?php
if ($config["metaconsole"] == 0){
$msg_cnt = messages_get_count ($config["id_user"]);
if ($msg_cnt > 0) {
echo '<div id="dialog_messages" style="display: none"></div>';
ui_require_css_file ('dialog');
ui_require_jquery_file ('ui.core');
ui_require_jquery_file ('ui.dialog');
echo '<a href="ajax.php?page=operation/messages/message" title="' . __("Message overview") . '" id="show_messages_dialog">';
html_print_image ("images/email.png", false,
array ("title" => __('You have %d unread message(s)', $msg_cnt), "id" => "yougotmail", "class" => "bot"));
echo '</a>';
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
}
}
if ($config["alert_cnt"] > 0){
echo '<div id="alert_messages" style="display: none"></div>';
ui_require_css_file ('dialog');
ui_require_jquery_file ('ui.core');
ui_require_jquery_file ('ui.dialog');
echo '<a href="ajax.php?page=operation/system_alert" title="'.__("System alerts detected - Please fix as soon as possible").'" id="show_systemalert_dialog">';
html_print_image ("images/error.png", false,
array ("title" => __('You have %d warning(s)', $config["alert_cnt"]), "id" => "yougotalert", "class" => "bot"));
echo '</a>';
echo "&nbsp;";
echo "&nbsp;";
}
echo '<a class="white_bold" href="index.php?bye=bye">';
html_print_image("images/log-out.png", false, array("alt" => __('Logout'), "class" => 'bot', "title" => __('Logout')));
echo '</a></td>';
echo '<td width="20%">';
if ($config["metaconsole"] == 0){
echo '<a class="white_bold" href="index.php?sec=estado_server&amp;sec2=operation/servers/view_server&amp;refr=60">';
$servers["all"] = (int) db_get_value ('COUNT(id_server)','tserver');
$servers["up"] = (int) servers_check_status ();
$servers["down"] = $servers["all"] - $servers["up"];
if ($servers["up"] == 0) {
//All Servers down or no servers at all
echo html_print_image("images/cross.png", true, array("alt" => 'cross', "class" => 'bot')) . '&nbsp;'.__('All systems').': '.__('Down');
}
elseif ($servers["down"] != 0) {
//Some servers down
echo html_print_image("images/error.png", true, array("alt" => 'error', "class" => 'bot')) . '&nbsp;'.$servers["down"].' '.__('servers down');
}
else {
//All servers up
echo html_print_image("images/ok.png", true, array("alt" => 'ok', "class" => 'bot')) . '&nbsp;'.__('All systems').': '.__('Ready');
}
unset ($servers); // Since this is the header, we don't like to trickle down variables.
echo '</a>';
} else {
// TODO: Put here to remark this is a metaconsole
echo "";
}
if ($config["alert_cnt"] > 0){
echo '<div id="alert_messages" style="display: none"></div>';
ui_require_css_file ('dialog');
echo '<a href="ajax.php?page=operation/system_alert" title="'.__("System alerts detected - Please fix as soon as possible").'" id="show_systemalert_dialog">';
html_print_image ("images/error.png", false,
array ("title" => __('You have %d warning(s)', $config["alert_cnt"]), "id" => "yougotalert", "class" => "bot"));
echo '</a>';
echo "&nbsp;";
echo "&nbsp;";
}
echo '<a class="white_bold" href="index.php?bye=bye">';
html_print_image("images/log-out.png", false, array("alt" => __('Logout'), "class" => 'bot', "title" => __('Logout')));
echo '</a></td>';
echo '<td width="20%">';
if ($config["metaconsole"] == 0){
echo '<a class="white_bold" href="index.php?sec=estado_server&amp;sec2=operation/servers/view_server&amp;refr=60">';
$servers["all"] = (int) db_get_value ('COUNT(id_server)','tserver');
$servers["up"] = (int) servers_check_status ();
$servers["down"] = $servers["all"] - $servers["up"];
if ($servers["up"] == 0) {
//All Servers down or no servers at all
echo html_print_image("images/cross.png", true, array("alt" => 'cross', "class" => 'bot')) . '&nbsp;'.__('All systems').': '.__('Down');
}
elseif ($servers["down"] != 0) {
//Some servers down
echo html_print_image("images/error.png", true, array("alt" => 'error', "class" => 'bot')) . '&nbsp;'.$servers["down"].' '.__('servers down');
}
else {
//All servers up
echo html_print_image("images/ok.png", true, array("alt" => 'ok', "class" => 'bot')) . '&nbsp;'.__('All systems').': '.__('Ready');
}
unset ($servers); // Since this is the header, we don't like to trickle down variables.
echo '</a>';
}
else {
// TODO: Put here to remark this is a metaconsole
echo "";
}
?>
</td>
<td width="20%">
@ -161,7 +160,7 @@ config_check();
if ($config["metaconsole"] == 0){
?>
<form method="get" style="" name="quicksearch" action="">
<script type="text/javascript" language="javascript">
<script type="text/javascript">
var fieldKeyWordEmpty = true;
</script>
<input type="text" id="keywords" name="keywords"
@ -174,9 +173,9 @@ config_check();
?>
onfocus="javascript: if (fieldKeyWordEmpty) $('#keywords').val('');"
size="100" style="background: white url('images/lupa_15x15.png') no-repeat right; padding: 0; padding-left:0px; margin: 0; width: 90%; height: 19px; margin-bottom: 5px; margin-left: 2px;" />
<!-- onClick="javascript: document.quicksearch.submit()" -->
<!-- onClick="javascript: document.quicksearch.submit()" -->
<input type='hidden' name='head_search_keywords' value='abc' />
</form>
</form>
<?php
}
?>
@ -192,15 +191,17 @@ if ($config["metaconsole"] == 0){
</table>
<?php
ui_require_jquery_file ('countdown');
ui_require_css_file ('jquery-ui-1.8.17.custom');
ui_require_jquery_file('jquery-ui-1.8.17.custom.min');
?>
<!--
<script type="text/javascript" src="include/javascript/jquery.ui.dialog.js "></script>
<script type="text/javascript" src="include/javascript/jquery.ui.draggable.js "></script>
<script type="text/javascript" src="include/javascript/jquery.ui.droppable.js "></script>
<script type="text/javascript" src="include/javascript/jquery.ui.resizable.js "></script>
<script type="text/javascript" src="include/javascript/jquery.ui.droppable.js "></script>
<script type="text/javascript" src="include/javascript/jquery.ui.resizable.js "></script>
-->
<script language="javascript" type="text/javascript">
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready (function () {
/* Temporal fix to hide graphics when ui_dialog are displayed */

View File

@ -174,7 +174,7 @@
if ($config['integria_enabled'] == 0){
echo "<a href='index.php?sec=incidencias&sec2=operation/incidents/incident&estado=0'>";
html_print_image("images/book_edit.png", false, array("title" => __("Incidents opened"), "style" => "margin-bottom: -5px;"));
echo "&nbsp;";
echo "&nbsp;";
// Select only opened incidents
$sql = "SELECT count(*) total_incidents FROM tincidencia WHERE
id_grupo IN (".implode (",",array_keys ($own_groups)).") AND estado IN (0)

View File

@ -18,6 +18,7 @@ if (is_ajax ()) {
global $config;
$search_parents = (bool) get_parameter ('search_parents');
$search_parents_2 = (bool) get_parameter ('search_parents_2');
if ($search_parents) {
require_once ('include/functions_agents.php');
@ -49,6 +50,41 @@ if (is_ajax ()) {
return;
}
if ($search_parents_2) {
require_once ('include/functions_agents.php');
$id_agent = (int) get_parameter ('id_agent');
$string = (string) get_parameter ('q'); /* q is what autocomplete plugin gives */
$filter = array ();
switch ($config['dbtype']){
case "mysql":
case "postgresql":
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
break;
case "oracle":
$filter[] = '(upper(nombre) LIKE upper("%'.$string.'%") OR upper(direccion) LIKE upper("%'.$string.'%") OR upper(comentarios) LIKE upper("%'.$string.'%"))';
break;
}
$filter[] = 'id_agente != '.$id_agent;
$agents = agents_get_agents ($filter, array ('id_agente', 'nombre', 'direccion'));
if ($agents === false)
$agents = array();
$data = array();
foreach ($agents as $agent) {
$data[] = array('id' => $agent['id_agente'],
'name' => io_safe_output($agent['nombre']),
'ip' => io_safe_output($agent['direccion']));
}
echo json_encode($data);
return;
}
$get_modules_json_for_multiple_snmp = (bool) get_parameter("get_modules_json_for_multiple_snmp", 0);
if ($get_modules_json_for_multiple_snmp) {
require_once ('include/graphs/functions_utils.php');
@ -363,7 +399,6 @@ echo '</div></form>';
ui_require_jquery_file ('pandora.controls');
ui_require_jquery_file ('ajaxqueue');
ui_require_jquery_file ('bgiframe');
ui_require_jquery_file ('autocomplete');
?>
<script type="text/javascript">
/* <![CDATA[ */
@ -403,28 +438,65 @@ function changeIcons() {
$(document).ready (function () {
$("select#id_os").pandoraSelectOS ();
$("#text-id_parent").autocomplete ("ajax.php",
{
scroll: true,
minChars: 2,
extraParams: {
page: "godmode/agentes/agent_manager",
search_parents: 1,
id_group: function() { return $("#grupo").val(); },
id_agent: <?php echo $id_agente ?>
},
formatItem: function (data, i, total) {
if (total == 0)
$("#text-id_parent").css ('background-color', '#cc0000');
else
$("#text-id_parent").css ('background-color', '');
if (data == "")
return false;
return data[0]+'<br><span class="ac_extra_field"><?php echo __("IP") ?>: '+data[1]+'</span>';
},
delay: 200
$("#text-id_parent").autocomplete({
minLength: 2,
source: function( request, response ) {
var term = request.term; //Word to search
var data_params = {
"page": "godmode/agentes/agent_manager",
"search_parents_2": 1,
"q": term};
jQuery.ajax ({
data: data_params,
async: false,
type: "POST",
url: action="ajax.php",
timeout: 10000,
dataType: "json",
success: function (data) {
response(data);
return;
}
});
return;
},
select: function( event, ui ) {
var agent_name = ui.item.name;
//Put the name
$(this).val(agent_name);
return false;
}
);
})
.data( "autocomplete")._renderItem = function( ul, item ) {
if (item.ip == "") {
text = "<a>" + item.name + "</a>";
}
else {
text = "<a>" + item.name
+ "<br><span style=\"font-size: 70%; font-style: italic;\">IP:" + item.ip + "</span></a>";
}
return $("<li></li>")
.data("item.autocomplete", item)
.append(text)
.appendTo(ul);
};
//Force the size of autocomplete
$(".ui-autocomplete").css("max-height", "100px");
$(".ui-autocomplete").css("overflow-y", "auto");
/* prevent horizontal scrollbar */
$(".ui-autocomplete").css("overflow-x", "hidden");
/* add padding to account for vertical scrollbar */
$(".ui-autocomplete").css("padding-right", "20px");
//Force to style of items
$(".ui-autocomplete").css("text-align", "left");
});
/* ]]> */
</script>

View File

@ -1,208 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 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.
// Load global vars
global $config;
check_login();
$origen = get_parameter ("origen", -1);
$id_group = get_parameter ("id_group", -1);
$update_agent = get_parameter ("update_agent", -1);
$update_group = get_parameter ("update_group", -1);
if (! check_acl ($config['id_user'], 0, "AW")) {
db_pandora_audit("ACL Violation",
"Trying to access remote config copy tool");
require ("general/noaccess.php");
exit;
}
require_once ($config['homedir'].'/include/functions_agents.php');
require_once ($config['homedir'].'/include/functions_users.php');
// Operations
if ((isset($_GET["operacion"])) AND ($update_group == -1) ) {
// DATA COPY
// ---------
if (isset($_POST["copy"])) {
// Header
ui_print_page_header (__("Data Copy"), "images/god1.png", false, "", true, "");
// Initial checkings
// if selected more than 0 agents
if (isset($_POST["destino"])) {
$destino = $_POST["destino"];
if (count($destino) <= 0){
echo "<h3 class='error'>ERROR: ".__('No selected agents to copy')."</h3>";
echo "</table>";
echo '</div>';
echo '<div style="clear:both">&nbsp;</div>';
echo '</div>';
echo '<div id="foot">';
require ("general/footer.php");
echo '</div>';
echo '</div>';
exit;
}
}
else {
echo "<h3 class='error'>ERROR: ".__('No source agent selected')."</h3>";
echo "</table>";
echo '</div>';
echo '<div style="clear:both">&nbsp;</div>';
echo '</div>';
echo '<div id="foot">';
require ("general/footer.php");
echo '</div>';
echo '</div>';
exit;
}
// Source
$id_origen = get_parameter ("origen");
// Security check here
if (!users_access_to_agent ($id_origen)) {
db_pandora_audit("ACL Violation", "Trying to forge a source agent in remote config tool");
require ("general/noaccess.php");
exit;
}
// Copy files
for ($a=0;$a <count($destino); $a++){
// For every agent in destination
//Security check here
$id_agente = $destino[$a];
// Security check here
if (!users_access_to_agent ($id_agente)){
db_pandora_audit("ACL Violation", "Trying to forge a source agent in remote config tool");
require ("general/noaccess.php");
exit;
}
$agent_name_src = agents_get_name($id_origen, "");
$agent_name_dst = agents_get_name($id_agente, "");
echo "<br><br>".__('Making copy of configuration file for')." [<b>".$agent_name_src."</b>] ".__('to')." [<b>".$agent_name_dst."</b>]";
$agent_md5_src = md5($agent_name_src);
$agent_md5_dst = md5($agent_name_dst);
copy ( $config["remote_config"]."/md5/".$agent_md5_src.".md5", $config["remote_config"]."/md5/".$agent_md5_dst.".md5" );
copy ( $config["remote_config"]."/conf/".$agent_md5_src.".conf", $config["remote_config"]."/conf/".$agent_md5_dst.".conf" );
} // for each destination agent
} //end if copy modules or alerts
// ============
// Form view
// ============
} else {
// title
// Header
ui_print_page_header (__("Remote configuration management"), "images/god1.png", false, "", true, "");
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/manage_config_remote&operacion=1">';
echo "<table width='98%' border='0' cellspacing='4' cellpadding='4' class='databox'>";
// Source group
echo '<tr><td class="datost"><b>'. __('Source group'). '</b><br><br>';
$group_select = users_get_groups ($config['id_user']);
$grouplist = implode (',', array_keys ($group_select));
echo html_print_select_groups($config['id_user'], "AR", true, 'id_group', $id_group, '', '', '', true, false, true, '', false, 'width:180px;');
echo '&nbsp;&nbsp;';
echo '<input type=submit name="update_group" class="sub upd" value="'.__('Filter').'">';
echo '<br><br>';
// Source agent
echo '<b>'. __('Source agent').'</b>';
ui_print_help_icon ('duplicateconfig');
echo '<br><br>';
// Show combo with SOURCE agents
if ($id_group > 0)
$sql1 = "SELECT * FROM tagente WHERE id_grupo = $id_group ORDER BY nombre ";
else
$sql1 = "SELECT * FROM tagente WHERE id_grupo IN ($grouplist) ORDER BY nombre";
echo '<select name="origen" style="width:200px">';
$rows = db_get_all_rows_sql($sql1);
if ($rows === false) {
$rows = array();
}
foreach ($rows as $row) {
if (check_acl ($config["id_user"], $row["id_grupo"], "AR")){
$source = $config["remote_config"]."/conf/". md5($row["nombre"]).".conf";
if (file_exists($source)){
echo "<option value=".$row["id_agente"].">".$row["nombre"]."</option>";
}
}
}
echo '</select>';
echo '</td></tr>';
// Destination agent
echo '<tr><td class="datost">';
echo '<b>'.__('To agent(s):').'</b><br><br>';
echo "<select name=destino[] size='10' multiple='multiple' style='width: 350px;'>";
if ($id_group > 0)
$sql1 = "SELECT * FROM tagente WHERE id_grupo = $id_group ORDER BY nombre ";
else
$sql1 = "SELECT * FROM tagente WHERE id_grupo IN ($grouplist) ORDER BY nombre";
$rows = db_get_all_rows_sql($sql1);
if ($rows === false) {
$rows = array();
}
foreach ($rows as $row) {
if (check_acl ($config["id_user"], $row["id_grupo"], "AW"))
echo "<option value=".$row["id_agente"].">".$row["nombre"]."</option>";
}
echo '</select>';
echo '</td>';
// Form buttons
echo '<td align="right" class="datosb">';
echo '<input type="submit" name="copy" class="sub next" value="'.__('Replicate configuration').'" onClick="if (!confirm("'.__('Are you sure?').'")) return false;>';
echo '</td></tr>';
echo '</table>';
}
?>
<script type="text/javascript">
$(document).ready (function () {
$("#id_group").click (
function () {
$(this).css ("width", "auto");
});
$("#id_group").blur (function () {
$(this).css ("width", "180px");
});
});
</script>

View File

@ -29,8 +29,7 @@ if (check_acl ($config['id_user'], 0, "AW")) {
$menu["gagente"]["sec2"] = "godmode/agentes/modificar_agente";
$menu["gagente"]["id"] = "god-agents";
$sub = array ();
$sub["godmode/agentes/manage_config_remote"]["text"] = __('Duplicate config');
$sub = array ();
if (check_acl ($config["id_user"], 0, "PM")) {
$sub["godmode/groups/group_list"]["text"] = __('Manage groups');

View File

@ -370,19 +370,54 @@ html_print_input_hidden('id_item', $idItem);
</tr>
<tr id="row_description" style="" class="datos">
<td style="vertical-align: top;"><?php echo __('Description'); ?></td>
<td style=""><?php echo html_print_textarea('description', 3, 25, $description); ?></td>
<td style="">
<?php
echo html_print_textarea('description', 3, 25, $description);
?>
</td>
</tr>
<tr id="row_period" style="" class="datos">
<td style="vertical-align: top;"><?php echo __('Period'); ?></td>
<td style=""><?php html_print_extended_select_for_time ($intervals, 'period', $period, '', '', '0', 10); echo __(" seconds."); ?></td>
<td style="vertical-align: top;">
<?php
echo __('Period');
?>
</td>
<td style="">
<?php
html_print_extended_select_for_time ($intervals, 'period', $period, '', '', '0', 10);
echo __(" seconds."); ?></td>
</tr>
<tr id="row_period1" style="" class="datos">
<td style="vertical-align: top;"><?php echo __('Period'); if ($type == 'projection_graph'){ echo ui_print_help_icon('projection_graph', true); }else{ echo ui_print_help_icon('prediction_date', true); } ?></td>
<td style=""><?php html_print_extended_select_for_time ($intervals_1, 'period1', $period_pg, '', '', '0', 10); echo __(" seconds."); ?></td>
<td style="vertical-align: top;">
<?php
echo __('Period');
if ($type == 'projection_graph') {
echo ui_print_help_icon('projection_graph', true);
}
else {
echo ui_print_help_icon('prediction_date', true);
}
?>
</td>
<td style="">
<?php
html_print_extended_select_for_time ($intervals_1, 'period1', $period_pg, '', '', '0', 10);
echo __(" seconds.");
?>
</td>
</tr>
<tr id="row_estimate" style="" class="datos">
<td style="vertical-align: top;"><?php echo __('Projection period') . ui_print_help_icon('projection_graph', true); ?></td>
<td style=""><?php html_print_extended_select_for_time ($intervals_1, 'period2', $projection_period, '', '', '0', 10); echo __(" seconds."); ?></td>
<td style="vertical-align: top;">
<?php
echo __('Projection period') . ui_print_help_icon('projection_graph', true);
?>
</td>
<td style="">
<?php
html_print_extended_select_for_time ($intervals_1, 'period2', $projection_period, '', '', '0', 10);
echo __(" seconds.");
?>
</td>
</tr>
<tr id="row_interval" style="" class="datos">
<td style="vertical-align: top;"><?php echo __('Data range') . ui_print_help_icon('prediction_date', true); ?></td>
@ -395,7 +430,11 @@ html_print_input_hidden('id_item', $idItem);
</tr>
<tr id="row_only_display_wrong" style="" class="datos">
<td><?php echo __('Only display wrong SLAs');?></td>
<td><?php html_print_checkbox('checkbox_only_display_wrong', 1, $only_display_wrong);?></td>
<td>
<?php
html_print_checkbox('checkbox_only_display_wrong', 1, $only_display_wrong);
?>
</td>
</tr>
<tr id="row_working_time">
<td style="vertical-align: top;"><?php echo __('Working time');?></td>
@ -439,10 +478,11 @@ html_print_input_hidden('id_item', $idItem);
<td style="">
<?php
html_print_input_hidden('id_agent', $idAgent) .
html_print_input_text_extended ('agent', agents_get_name ($idAgent), 'text-agent', '', 30, 100, false, '',
array('style' => 'background: url(images/lightning.png) no-repeat right;'))
. ui_print_help_tip(__("Type at least two characters to search"), false);
html_print_input_hidden ('server_name', $server_name);
html_print_input_text_extended ('agent', agents_get_name ($idAgent),
'text-agent', '', 30, 100, false, '',
array('style' => 'background: url(images/lightning.png) no-repeat right;'))
. ui_print_help_tip(__("Type at least two characters to search"), false);
html_print_input_hidden ('server_name', $server_name);
?>
</td>
</tr>

View File

@ -236,7 +236,8 @@ switch ($action) {
$values['top_n_value'] = get_parameter('quantity');
$values['text'] = get_parameter('text');
$good_format = true;
}else{
}
else {
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter('radiobutton_max_min_avg');
$values['top_n_value'] = get_parameter('quantity');
@ -316,12 +317,13 @@ switch ($action) {
$values['description'] = get_parameter('description');
// Support for projection graph, prediction date and SLA reports
// 'top_n_value', 'top_n' and 'text' fields will be reused for these types of report
if ($values['type'] == 'projection_graph'){
if ($values['type'] == 'projection_graph') {
$values['period'] = get_parameter('period1');
$values['top_n_value'] = get_parameter('period2');
$values['text'] = get_parameter('text');
$good_format = true;
}else if ($values['type'] == 'prediction_date'){
}
else if ($values['type'] == 'prediction_date') {
$values['period'] = get_parameter('period1');
$values['top_n'] = get_parameter('radiobutton_max_min_avg');
$values['top_n_value'] = get_parameter('quantity');
@ -333,13 +335,15 @@ switch ($action) {
}
$intervals = get_parameter('max_interval') . ';' . get_parameter('min_interval');
$values['text'] = $intervals;
}else if ($values['type'] == 'SLA'){
}
else if ($values['type'] == 'SLA') {
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter('combo_sla_sort_options',0);
$values['top_n_value'] = get_parameter('quantity');
$values['text'] = get_parameter('text');
$good_format = true;
}else{
}
else {
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter('radiobutton_max_min_avg',0);
$values['top_n_value'] = get_parameter('quantity');
@ -349,7 +353,7 @@ switch ($action) {
$values['id_agent'] = get_parameter('id_agent');
$values['id_gs'] = get_parameter('id_custom_graph');
$values['id_agent_module'] = get_parameter('id_agent_module');
switch ($config['dbtype']){
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
$values['only_display_wrong'] = get_parameter('checkbox_only_display_wrong');
@ -371,7 +375,7 @@ switch ($action) {
$values['friday'] = get_parameter('friday', 0);
$values['saturday'] = get_parameter('saturday', 0);
$values['sunday'] = get_parameter('sunday', 0);
switch ($config['dbtype']){
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
$values['time_from'] = get_parameter('time_from');

View File

@ -138,11 +138,12 @@ $(document).ready (function () {
/* Show/hide begin date reports controls */
$("#checkbox-enable_init_date").click(function() {
flag = $("#checkbox-enable_init_date").is(':checked');
if (flag == true){
if (flag == true) {
$("#table1-1-3").css("display", "");
$("#table1-1-4").css("display", "");
$("#table1-1-5").css("display", "none");
}else{
}
else {
$("#table1-1-3").css("display", "none");
$("#table1-1-4").css("display", "none");
$("#table1-1-5").css("display", "");
@ -183,7 +184,8 @@ switch ($config["dbtype"]) {
if ($contents === false) {
return;
} else {
}
else {
foreach($contents as $content) {
$id_report = $content['id_rc'];
switch ($content['type']) {

View File

@ -22,4 +22,5 @@ define('ICON', 5);
define('SIMPLE_VALUE_MAX', 6);
define('SIMPLE_VALUE_MIN', 7);
define('SIMPLE_VALUE_AVG', 8);
define('PERCENTILE_BUBBLE', 9);
?>

View File

@ -44,7 +44,11 @@ function initJavascript() {
eventsItems();
eventsTextAgent();
draw_lines(lines, 'background');
//Fixed to wait the load of images.
$(window).load(function() {
draw_lines(lines, 'background', true);
}
);
$(".item").css('z-index', '1'); //For paint the icons over lines
}
@ -52,61 +56,90 @@ function initJavascript() {
function eventsTextAgent() {
var idText = $("#ip_text").html();
$("#text-agent").autocomplete(
"ajax.php",
{
minChars: 2,
scroll:true,
extraParams: {
page: "operation/agentes/exportdata",
all: "enabled",
search_agents: 1,
id_group: function() { return $("#group").val(); }
},
formatItem: function (data, i, total) {
if (total == 0)
$("#text-agent").css('background-color', '#cc0000');
else
$("#text-agent").css('background-color', '');
if (data == "")
return false;
return data[0]+'<br><span class="ac_extra_field">' + idText + ': '+data[1]+'</span>';
},
delay: 200
}
);
$("#text-agent").result (
function () {
selectAgent = true;
var agent_name = this.value;
$('#module').fadeOut ('normal', function () {
$('#module').empty ();
var inputs = [];
inputs.push ("filter=disabled = 0");
inputs.push ("agent_name=" + agent_name);
inputs.push ("get_agent_modules_json=1");
inputs.push ("page=operation/agentes/ver_agente");
jQuery.ajax ({
data: inputs.join ("&"),
type: 'GET',
url: action="ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
$('#module').append ($('<option></option>').attr ('value', 0).text ("--"));
jQuery.each (data, function (i, val) {
s = js_html_entity_decode (val['nombre']);
$('#module').append ($('<option></option>').attr ('value', val['id_agente_modulo']).text (s));
});
$('#module').fadeIn ('normal');
}
});
});
$("#text-agent").autocomplete({
minLength: 2,
source: function( request, response ) {
var term = request.term; //Word to search
}
);
var params = [];
params.push("all=enabled");
params.push("search_agents_2=1");
params.push("page=operation/agentes/exportdata");
params.push("id_group="+ $("#group").val());
params.push("q="+ term);
jQuery.ajax ({
data: params.join ("&"),
async: false,
type: 'POST',
url: action="ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
response(data);
return;
}
});
return;
},
select: function( event, ui ) {
var agent_name = ui.item.name;
//Put the name
$(this).val(agent_name);
//Fill the modules select box
$('#module').fadeOut ('normal', function () {
$('#module').empty ();
var inputs = [];
inputs.push ("filter=disabled = 0");
inputs.push ("agent_name=" + agent_name);
inputs.push ("get_agent_modules_json=1");
inputs.push ("page=operation/agentes/ver_agente");
jQuery.ajax ({
data: inputs.join ("&"),
type: 'GET',
url: action="ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
$('#module').append ($('<option></option>').attr ('value', 0).text ("--"));
jQuery.each (data, function (i, val) {
s = js_html_entity_decode (val['nombre']);
$('#module').append ($('<option></option>').attr ('value', val['id_agente_modulo']).text (s));
});
$('#module').fadeIn ('normal');
}
});
});
return false;
}
})
.data( "autocomplete")._renderItem = function( ul, item ) {
if (item.ip == '') {
text = "<a>" + item.name + "</a>";
}
else {
text = "<a>" + item.name
+ "<br><span style='font-size: 70%; font-style: italic;'>IP:" + item.ip + "</span></a>";
}
return $("<li></li>")
.data("item.autocomplete", item)
.append(text)
.appendTo(ul);
};
//Force the size of autocomplete
$(".ui-autocomplete").css("max-height", "100px");
$(".ui-autocomplete").css("overflow-y", "auto");
/* prevent horizontal scrollbar */
$(".ui-autocomplete").css("overflow-x", "hidden");
/* add padding to account for vertical scrollbar */
$(".ui-autocomplete").css("padding-right", "20px");
//Force to style of items
$(".ui-autocomplete").css("text-align", "left");
}
function cancelAction() {
@ -131,7 +164,7 @@ function updateAction() {
$("#background").css('height', values['height']);
//$("#background").css('background', 'url(images/console/background/' + values['background'] + ')');
var params = [];
params.push("get_image_path=1");
params.push("img_src=images/console/background/" + values['background']);
@ -154,7 +187,7 @@ function updateAction() {
$("#text_" + idItem).html(values['label']);
$("#" + idItem).css('color', values['label_color']);
switch ($('#hidden-status_' + idItem).val()) {
case '1':
//Critical (BAD)
@ -178,7 +211,7 @@ function updateAction() {
suffix = ".png";
// Default is Grey (Other)
}
var params = [];
params.push("get_image_path=1");
params.push("img_src=images/console/icons/" + values['image'] + suffix);
@ -194,7 +227,7 @@ function updateAction() {
$("#image_" + idItem).attr('src', data);
}
});
if ((values['width'] != 0) && (values['height'] != 0)) {
$("#image_" + idItem).attr('width', values['width']);
$("#image_" + idItem).attr('height', values['height']);
@ -209,8 +242,15 @@ function updateAction() {
}
break;
case 'percentile_bar':
case 'percentile_item':
$("#text_" + idItem).html(values['label']);
$("#image_" + idItem).attr('src', getPercentileBar(idItem));
if (values['type_percentile'] == 'bubble') {
$("#image_" + idItem).attr('src', getPercentileBubble(idItem, values));
}
else {
$("#image_" + idItem).attr('src', getPercentileBar(idItem, values));
}
break;
case 'module_graph':
$("#text_" + idItem).html(values['label']);
@ -225,10 +265,9 @@ function updateAction() {
$("#text_" + idItem).html(values['label']);
break;
case 'icon':
var params = [];
params.push("get_image_path=1");
params.push("img_src=" + getImageElement(idItem));
params.push("img_src=images/console/icons/" + values['image'] + ".png");
params.push("page=include/ajax/skins.ajax");
params.push("only_src=1");
jQuery.ajax ({
@ -241,7 +280,7 @@ function updateAction() {
$("#image_" + idItem).attr('src', data);
}
});
if ((values['width'] != 0) && (values['height'] != 0)) {
$("#image_" + idItem).attr('width', values['width']);
$("#image_" + idItem).attr('height', values['height']);
@ -258,7 +297,7 @@ function updateAction() {
}
updateDB(selectedItem, idItem , values);
actionClick();
}
@ -283,6 +322,8 @@ function readFields() {
values['max_percentile'] = $("input[name=max_percentile]").val();
values['width_module_graph'] = $("input[name=width_module_graph]").val();
values['height_module_graph'] = $("input[name=height_module_graph]").val();
values['type_percentile'] = $("input[name=type_percentile]:checked").val();
values['value_show'] = $("input[name=value_show]:checked").val();
return values;
}
@ -312,6 +353,7 @@ function createAction() {
}
break;
case 'percentile_bar':
case 'percentile_item':
if ((values['agent'] == '')) {
alert($("#message_alert_no_agent").html());
validate = false;
@ -370,11 +412,11 @@ function actionClick() {
if (openPropertiesPanel) {
activeToolboxButton('static_graph', true);
activeToolboxButton('percentile_bar', true);
activeToolboxButton('module_graph', true);
activeToolboxButton('simple_value', true);
activeToolboxButton('label', true);
activeToolboxButton('icon', true);
activeToolboxButton('percentile_item', true);
$(".item").draggable("enable");
$("#background").resizable('enable');
@ -393,11 +435,11 @@ function actionClick() {
$("#background").resizable('disable');
activeToolboxButton('static_graph', false);
activeToolboxButton('percentile_bar', 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);
@ -405,6 +447,7 @@ function actionClick() {
if (creationItem != null) {
//Create a item
activeToolboxButton(creationItem, true);
item = creationItem;
$("#button_update_row").css('display', 'none');
@ -414,8 +457,10 @@ function actionClick() {
}
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();
@ -482,6 +527,28 @@ function loadFieldsFromDB(item) {
if (key == 'max_percentile') $("input[name=max_percentile]").val(val);
if (key == 'width_module_graph') $("input[name=width_module_graph]").val(val);
if (key == 'height_module_graph') $("input[name=height_module_graph]").val(val);
if (key == 'type_percentile') {
if (val == 'percentile') {
$("input[name=type_percentile][value=percentile]")
.attr("checked", "checked");
}
else {
$("input[name=type_percentile][value=bubble]")
.attr("checked", "checked");
}
}
if (key == 'value_show') {
if (val == 'percent') {
$("input[name=value_show][value=percent]")
.attr("checked", "checked");
}
else {
$("input[name=value_show][value=value]")
.attr("checked", "checked");
}
}
});
}
});
@ -583,10 +650,16 @@ function hiddenFields(item) {
$("#percentile_bar_row_1").css('display', 'none');
$("#percentile_bar_row_1." + item).css('display', '');
$("#percentile_bar_row_2").css('display', 'none');
$("#percentile_bar_row_2." + item).css('display', '');
$("#percentile_item_row_3").css('display', 'none');
$("#percentile_item_row_3." + item).css('display', '');
$("#percentile_item_row_4").css('display', 'none');
$("#percentile_item_row_4." + item).css('display', '');
$("#period_row").css('display', 'none');
$("#period_row." + item).css('display', '');
@ -697,13 +770,13 @@ function getModuleValue(id_data) {
return module_value;
}
function getPercentileBar(id_data) {
function getPercentileBar(id_data, values) {
var parameter = Array();
var percentile = 0;
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_module_value"});
parameter.push ({name: "id_element", value: id_data});
parameter.push ({name: "value_show", value: values['value_show']});
jQuery.ajax({
async: false,
url: "ajax.php",
@ -715,6 +788,10 @@ function getPercentileBar(id_data) {
module_value = data['value'];
max_percentile = data['max_percentile'];
width_percentile = data['width_percentile'];
unit_text = false
if (data['unit_text'] != false)
unit_text = data['unit_text'];
colorRGB = data['colorRGB'];
}
});
@ -736,14 +813,84 @@ function getPercentileBar(id_data) {
});
if ( max_percentile > 0)
percentile = module_value / max_percentile * 100;
var percentile = Math.round(module_value / max_percentile * 100);
else
percentile = 100;
var percentile = 100;
if (unit_text == false) {
value_text = percentile + "%";
}
else {
value_text = module_value + " " + unit_text;
}
var img = 'include/graphs/fgraph.php?homeurl=../../&graph_type=progressbar&height=15&' +
'width=' + width_percentile + '&mode=1&progress=' + percentile + '&font=' + font;
'width=' + width_percentile + '&mode=1&progress=' + percentile +
'&font=' + font + '&value_text=' + value_text + '&colorRGB=' + colorRGB;
return img;
}
function getPercentileBubble(id_data, values) {
var parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_module_value"});
parameter.push ({name: "id_element", value: id_data});
parameter.push ({name: "value_show", value: values['value_show']});
jQuery.ajax({
async: false,
url: "ajax.php",
data: parameter,
type: "POST",
dataType: 'json',
success: function (data)
{
module_value = data['value'];
max_percentile = data['max_percentile'];
width_percentile = data['width_percentile'];
unit_text = false
if (data['unit_text'] != false)
unit_text = data['unit_text'];
colorRGB = data['colorRGB'];
}
});
//Get the actual system font.
parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_font"});
jQuery.ajax({
async: false,
url: "ajax.php",
data: parameter,
type: "POST",
dataType: 'json',
success: function (data)
{
font = data['font'];
}
});
if ( max_percentile > 0)
var percentile = Math.round(module_value / max_percentile * 100);
else
var percentile = 100;
if (unit_text == false) {
value_text = percentile + "%";
}
else {
value_text = module_value + " " + unit_text;
}
var img = 'include/graphs/fgraph.php?homeurl=../../&graph_type=progressbubble&height=' + width_percentile + '&' +
'width=' + width_percentile + '&mode=1&progress=' + percentile +
'&font=' + font + '&value_text=' + value_text + '&colorRGB=' + colorRGB;
return img;
}
@ -809,13 +956,13 @@ function createItem(type, values, id_data) {
sizeStyle = 'width: ' + values['width'] + 'px; height: ' + values['height'] + 'px;';
imageSize = 'width="' + values['width'] + '" height="' + values['height'] + '"';
}
var element_status= null;
var parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "get_element_status", value: "1"});
parameter.push ({name: "id_element", value: id_data});
jQuery.ajax ({
type: 'POST',
url: action="ajax.php",
@ -826,14 +973,14 @@ function createItem(type, values, id_data) {
element_status = data;
}
});
var img_src= null;
var parameter = Array();
parameter.push ({name: "page", value: "include/ajax/skins.ajax"});
parameter.push ({name: "get_image_path", value: "1"});
parameter.push ({name: "img_src", value: getImageElement(id_data)});
parameter.push ({name: "only_src", value: "1"});
jQuery.ajax ({
type: 'POST',
url: action="ajax.php",
@ -847,27 +994,41 @@ function createItem(type, values, id_data) {
item = $('<div id="' + id_data
+ '" class="item static_graph" '
+ 'style="left: 0px; top: 0px; color: ' + values['label_color'] + '; text-align: center; position: absolute; ' + sizeStyle + ' margin-top: ' + values['top'] + 'px; margin-left: ' + values['left'] + 'px;">' +
+ 'style="color: ' + values['label_color']
+ '; text-align: center; position: absolute; display: inline-block; '
+ sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<img id="image_' + id_data + '" class="image" src="' + img_src + '" ' + imageSize + ' /><br />' +
'<span id="text_' + id_data + '" class="text">' + values['label'] + '</span>' +
'</div><input id="hidden-status_' + id_data + '" type="hidden" value="' + element_status + '" name="status_' + id_data + '">'
);
break;
case 'percentile_bar':
sizeStyle = '';
imageSize = '';
case 'percentile_item':
var sizeStyle = '';
var imageSize = '';
item = $('<div id="' + id_data + '" class="item percentile_bar" style="left: 0px; top: 0px; color: ' + values['label_color'] + '; text-align: center; position: absolute; ' + sizeStyle + ' margin-top: ' + values['top'] + 'px; margin-left: ' + values['left'] + 'px;">' +
'<span id="text_' + id_data + '" class="text">' + values['label'] + '</span><br />' +
'<img class="image" id="image_' + id_data + '" src="' + getPercentileBar(id_data) + '" />' +
'</div>'
);
if (values['type_percentile'] == 'percentile') {
item = $('<div id="' + id_data + '" class="item percentile_item" style="color: ' + values['label_color'] +
'; text-align: center; position: absolute; display: inline-block; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<span id="text_' + id_data + '" class="text">' + values['label'] + '</span><br />' +
'<img class="image" id="image_' + id_data + '" src="' + getPercentileBar(id_data, values) + '" />' +
'</div>'
);
}
else {
item = $('<div id="' + id_data + '" class="item percentile_item" style="color: ' + values['label_color'] +
'; text-align: center; position: absolute; display: inline-block; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<span id="text_' + id_data + '" class="text">' + values['label'] + '</span><br />' +
'<img class="image" id="image_' + id_data + '" src="' + getPercentileBubble(id_data, values) + '" />' +
'</div>'
);
}
break;
case 'module_graph':
sizeStyle = '';
imageSize = '';
item = $('<div id="' + id_data + '" class="item module_graph" style="left: 0px; top: 0px; color: ' + values['label_color'] + '; text-align: center; position: absolute; ' + sizeStyle + ' margin-top: ' + values['top'] + 'px; margin-left: ' + values['left'] + 'px;">' +
item = $('<div id="' + id_data + '" class="item module_graph" style="color: ' + values['label_color'] + '; text-align: center; position: absolute; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<span id="text_' + id_data + '" class="text">' + values['label'] + '</span><br />' +
'<img class="image" id="image_' + id_data + '" src="' + getModuleGraph(id_data) + '" style="border:1px solid #808080;" />' +
'</div>'
@ -877,14 +1038,14 @@ function createItem(type, values, id_data) {
sizeStyle = '';
imageSize = '';
item = $('<div id="' + id_data + '" class="item simple_value" style="left: 0px; top: 0px; color: ' + values['label_color'] + '; text-align: center; position: absolute; ' + sizeStyle + ' margin-top: ' + values['top'] + 'px; margin-left: ' + values['left'] + 'px;">' +
item = $('<div id="' + id_data + '" class="item simple_value" style="color: ' + values['label_color'] + '; text-align: center; position: absolute; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<span id="text_' + id_data + '" class="text"> ' + values['label'] + '</span>' +
'<strong>' + getModuleValue(id_data) + '</strong>' +
'</div>'
);
break;
case 'label':
item = $('<div id="' + id_data + '" class="item label" style="left: 0px; top: 0px; color: ' + values['label_color'] + '; text-align: center; position: absolute; ' + sizeStyle + ' margin-top: ' + values['top'] + 'px; margin-left: ' + values['left'] + 'px;">' +
item = $('<div id="' + id_data + '" class="item label" style="color: ' + values['label_color'] + '; text-align: center; position: absolute; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<span id="text_' + id_data + '" class="text">' + values['label'] + '</span>' +
'</div>'
);
@ -916,8 +1077,8 @@ function createItem(type, values, id_data) {
img_src = data;
}
});
item = $('<div id="' + id_data + '" class="item icon" style="left: 0px; top: 0px; color: ' + values['label_color'] + '; text-align: center; position: absolute; ' + sizeStyle + ' margin-top: ' + values['top'] + 'px; margin-left: ' + values['left'] + 'px;">' +
item = $('<div id="' + id_data + '" class="item icon" style="color: ' + values['label_color'] + '; text-align: center; position: absolute; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<img id="image_' + id_data + '" class="image" src="' + img_src + '" ' + imageSize + ' /><br />' +
'</div>'
);
@ -934,7 +1095,7 @@ function createItem(type, values, id_data) {
"color": visual_map_get_color_line_status(id_data) };
lines.push(line);
refresh_lines(lines, 'background');
refresh_lines(lines, 'background', true);
}
}
@ -980,24 +1141,24 @@ function updateDB_visual(type, idElement , values, event, top, left) {
case 'module_graph':
$("#image_" + idElement).attr("src", getModuleGraph(idElement));
case 'static_graph':
case 'percentile_bar':
case 'percentile_item':
case 'simple_value':
case 'label':
case 'icon':
if ((typeof(values['mov_left']) != 'undefined') &&
(typeof(values['mov_top']) != 'undefined')) {
$("#" + idElement).css('top', '0px').css('margin-top', top + 'px');
$("#" + idElement).css('left', '0px').css('margin-left', left + 'px');
$("#" + idElement).css('top', '0px').css('top', top + 'px');
$("#" + idElement).css('left', '0px').css('left', left + 'px');
}
else if ((typeof(values['absolute_left']) != 'undefined') &&
(typeof(values['absolute_top']) != 'undefined')) {
$("#" + idElement).css('top', '0px').css('margin-top', top + 'px');
$("#" + idElement).css('left', '0px').css('margin-left', left + 'px');
$("#" + idElement).css('top', '0px').css('top', top + 'px');
$("#" + idElement).css('left', '0px').css('left', left + 'px');
}
$("#" + idElement).css('color', values['label_color']);
found = false;
jQuery.each(lines, function(i, line) {
if (lines[i]['id'] == idElement) {
if (lines[i]['node_begin'] == idElement) {
found = true;
if (values['parent'] == 0) {
lines.splice(i);
@ -1021,7 +1182,7 @@ function updateDB_visual(type, idElement , values, event, top, left) {
lines.push(line);
}
refresh_lines(lines, 'background');
refresh_lines(lines, 'background', true);
break;
case 'background':
if(values['width'] == '0' || values['height'] == '0'){
@ -1067,11 +1228,8 @@ function updateDB(type, idElement , values, event) {
if ((typeof(values['mov_left']) != 'undefined') &&
(typeof(values['mov_top']) != 'undefined')) {
top = parseInt($("#" + idElement).css('margin-top').replace('px', ''));
left = parseInt($("#" + idElement).css('margin-left').replace('px', ''));
top = top + parseInt(values['mov_top']);
left = left + parseInt(values['mov_left']);
top = parseInt($("#" + idElement).css('top').replace('px', ''));
left = parseInt($("#" + idElement).css('left').replace('px', ''));
}
else if ((typeof(values['absolute_left']) != 'undefined') &&
(typeof(values['absolute_top']) != 'undefined')) {
@ -1080,8 +1238,15 @@ function updateDB(type, idElement , values, event) {
}
if ((typeof(top) != 'undefined') && (typeof(left) != 'undefined')) {
parameter.push ({name: 'top', value: top});
parameter.push ({name: 'left', value: left});
if ((typeof(values['top']) == 'undefined') &&
(typeof(values['left']) == 'undefined')) {
parameter.push ({name: 'top', value: top});
parameter.push ({name: 'left', value: left});
}
else {
values['top'] = top;
values['left'] = left;
}
}
success_update = false;
@ -1127,7 +1292,7 @@ function deleteDB(idElement) {
lines.splice(i);
}
});
refresh_lines(lines, 'background');
refresh_lines(lines, 'background', true);
$('#' + idElement).remove();
activeToolboxButton('delete_item', false);
@ -1187,13 +1352,13 @@ function eventsItems(drag) {
activeToolboxButton('delete_item', true);
activeToolboxButton('show_grid', false);
}
if ($(divParent).hasClass('percentile_bar')) {
if ($(divParent).hasClass('percentile_item')) {
creationItem = null;
selectedItem = 'percentile_bar';
selectedItem = 'percentile_item';
idItem = $(divParent).attr('id');
activeToolboxButton('edit_item', true);
activeToolboxButton('delete_item', true);
activeToolboxButton('show_grid', false);
activeToolboxButton('show_grid', false);
}
if ($(divParent).hasClass('module_graph')) {
creationItem = null;
@ -1238,54 +1403,39 @@ function eventsItems(drag) {
}
});
$(".item").draggable({grid: drag});
//Set the limit of draggable in the div with id "background" and set drag
//by default is false.
$(".item").draggable({containment: "#background", grid: drag});
$('.item').bind('dragstart', function(event, ui) {
event.stopPropagation();
if (!openPropertiesPanel) {
divParent = $(event.target).parent();
unselectAll();
$(divParent).css('border', '2px blue dotted');
$(event.target).css('border', '2px blue dotted');
if ($(divParent).hasClass('static_graph')) {
creationItem = null;
selectedItem = null;
if ($(event.target).hasClass('static_graph')) {
selectedItem = 'static_graph';
idItem = $(divParent).attr('id');
activeToolboxButton('edit_item', true);
activeToolboxButton('delete_item', true);
}
if ($(divParent).hasClass('percentile_bar')) {
creationItem = null;
selectedItem = 'percentile_bar';
idItem = $(divParent).attr('id');
activeToolboxButton('edit_item', true);
activeToolboxButton('delete_item', true);
if ($(event.target).hasClass('percentile_item')) {
selectedItem = 'percentile_item';
}
if ($(divParent).hasClass('module_graph')) {
creationItem = null;
if ($(event.target).hasClass('module_graph')) {
selectedItem = 'module_graph';
idItem = $(divParent).attr('id');
activeToolboxButton('edit_item', true);
activeToolboxButton('delete_item', true);
}
if ($(divParent).hasClass('simple_value')) {
creationItem = null;
if ($(event.target).hasClass('simple_value')) {
selectedItem = 'simple_value';
idItem = $(divParent).attr('id');
activeToolboxButton('edit_item', true);
activeToolboxButton('delete_item', true);
}
if ($(divParent).hasClass('label')) {
creationItem = null;
if ($(event.target).hasClass('label')) {
selectedItem = 'label';
idItem = $(divParent).attr('id');
activeToolboxButton('edit_item', true);
activeToolboxButton('delete_item', true);
}
if ($(divParent).hasClass('icon')) {
creationItem = null;
if ($(event.target).hasClass('icon')) {
selectedItem = 'icon';
idItem = $(divParent).attr('id');
}
if (selectedItem != null) {
creationItem = null;
idItem = $(event.target).attr('id');
activeToolboxButton('edit_item', true);
activeToolboxButton('delete_item', true);
}
@ -1296,7 +1446,6 @@ function eventsItems(drag) {
event.stopPropagation();
var values = {};
values['mov_left'] = ui.position.left;
values['mov_top'] = ui.position.top;
@ -1371,8 +1520,8 @@ function move_elements_resize(original_width, original_height, width, height) {
.replace('ui-draggable', '').replace('ui-draggable-disabled', '')
.replace(/^\s+/g,'').replace(/\s+$/g,'');
old_height = parseInt($(item).css('margin-top').replace('px', ''));
old_width = parseInt($(item).css('margin-left').replace('px', ''));
old_height = parseInt($(item).css('top').replace('px', ''));
old_width = parseInt($(item).css('left').replace('px', ''));
ratio_width = width / original_width;
ratio_height = height / original_height;
@ -1401,7 +1550,8 @@ function click_button_toolbox(id) {
actionClick();
break;
case 'percentile_bar':
toolbuttonActive = creationItem = 'percentile_bar';
case 'percentile_item':
toolbuttonActive = creationItem = 'percentile_item';
actionClick();
break;
case 'module_graph':
@ -1441,7 +1591,7 @@ function click_button_toolbox(id) {
//And it is necesary to re-code more parts of code to change
//this method.
activeToolboxButton('static_graph', false);
activeToolboxButton('percentile_bar', false);
activeToolboxButton('percentile_item', false);
activeToolboxButton('module_graph', false);
activeToolboxButton('simple_value', false);
activeToolboxButton('label', false);
@ -1468,7 +1618,7 @@ function click_button_toolbox(id) {
}
activeToolboxButton('static_graph', true);
activeToolboxButton('percentile_bar', true);
activeToolboxButton('percentile_item', true);
activeToolboxButton('module_graph', true);
activeToolboxButton('simple_value', true);
activeToolboxButton('label', true);
@ -1584,8 +1734,8 @@ function showGrid() {
.replace('ui-draggable', '').replace('ui-draggable-disabled', '')
.replace(/^\s+/g,'').replace(/\s+$/g,'');
pos_y = parseInt($(item).css('margin-top').replace('px', ''));
pos_x = parseInt($(item).css('margin-left').replace('px', ''));
pos_y = parseInt($(item).css('top').replace('px', ''));
pos_x = parseInt($(item).css('left').replace('px', ''));
pos_y = Math.floor(pos_y / SIZE_GRID) * SIZE_GRID;
pos_x = Math.floor(pos_x / SIZE_GRID) * SIZE_GRID;

View File

@ -47,7 +47,7 @@ foreach ($all_images as $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_bar', __('Percentile Bar'), 'left', false, 'percentile_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);
@ -97,15 +97,27 @@ echo '<div id="properties_panel" style="display: none; position: absolute; borde
?>
<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_bar" class="title_panel_span" style="display: none; font-weight: bolder;"><?php echo __('Percentile Bar');?></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>
<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_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 module_graph simple_value label datos icon">
<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>
@ -116,20 +128,21 @@ echo '<div id="properties_panel" style="display: none; position: absolute; borde
<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 module_graph simple_value datos">
<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 module_graph simple_value datos">
<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 ('1' => __('Min value'),
'2' => __('Max value'),
'3' => __('Avg value')), 'process_value', '', '', __('None'), 0);?></td>
<td><?php html_print_select (
array ('1' => __('Min value'),
'2' => __('Max value'),
'3' => __('Avg value')), 'process_value', '', '', __('None'), 0);?></td>
</tr>
<tr id="background_row_1" class="background datos">
<td><?php echo __('Background');?></td>
@ -147,7 +160,7 @@ echo '<div id="properties_panel" style="display: none; position: absolute; borde
<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 datos">
<tr id="percentile_bar_row_1" class="percentile_bar percentile_item datos">
<td><?php echo __('Width');?></td>
<td>
<?php
@ -155,7 +168,7 @@ echo '<div id="properties_panel" style="display: none; position: absolute; borde
?>
</td>
</tr>
<tr id="percentile_bar_row_2" class="percentile_bar datos">
<tr id="percentile_bar_row_2" class="percentile_bar percentile_item datos">
<td><?php echo __('Max value');?></td>
<td>
<?php
@ -163,6 +176,24 @@ echo '<div id="properties_panel" style="display: none; position: absolute; borde
?>
</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 datos">
<td><?php echo __('Period');?></td>
<td><?php html_print_select ($intervals, 'period', '', '', '--', 0, false, false, false);?></td>
@ -200,7 +231,7 @@ echo '<div id="properties_panel" style="display: none; position: absolute; borde
</tr>
</tbody>
<tbody id="advance_options" style="display: none;">
<tr id="position_row" class="static_graph percentile_bar module_graph simple_value label icon datos">
<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
@ -222,7 +253,7 @@ echo '<div id="properties_panel" style="display: none; position: absolute; borde
?>
</td>
</tr>
<tr id="parent_row" class="static_graph percentile_bar module_graph simple_value label icon datos">
<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
@ -231,7 +262,7 @@ echo '<div id="properties_panel" style="display: none; position: absolute; borde
?>
</td>
</tr>
<tr id="map_linked_row" class="static_graph percentile_bar module_graph simple_value icon label datos">
<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
@ -239,7 +270,7 @@ echo '<div id="properties_panel" style="display: none; position: absolute; borde
?>
</td>
</tr>
<tr id="label_color_row" class="static_graph percentile_bar module_graph simple_value label datos">
<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>
@ -249,20 +280,19 @@ echo '<div id="properties_panel" style="display: none; position: absolute; borde
//------------------------------------------------------------------------------
echo '</div>';
echo '<div id="frame_view" style="width: 100%; height: 500px; overflow: scroll;">';
//echo '<div id="background" class="ui-widget-content" style="background: url(images/console/background/' . $background . ');
// border: 2px black solid; width: ' . $widthBackground . 'px; height: ' . $heightBackground . 'px;">';
echo '<div id="background" class="ui-widget-content" style="
echo '<div id="background" class="" style="
border: 2px black solid; width: ' . $widthBackground . 'px; height: ' . $heightBackground . 'px;">';
//echo "<img style='opacity:.5' id='background_img' src='images/console/background/white_boxed.jpg' width='100%' height='100%' />";
echo "<div id='background_grid' style='position: absolute; display: none; overflow: hidden; background: url(images/console/background/white_boxed.jpg); background-repeat: repeat; width: " . $widthBackground . "px; height: " . $heightBackground . "px;'></div>"; //<img id='background_grid' style='display:none' src='images/console/background/white_boxed.jpg' width='100%' height='100%' /></div>";
echo "<img id='background_img' src='images/console/background/" . $background . "' width='100%' height='100%' />";
echo "<div id='background_grid'
style='position: absolute; display: none; overflow: hidden;
background: url(images/console/background/white_boxed.jpg);
background-repeat: repeat; width: " . $widthBackground . "px; height: " . $heightBackground . "px;'></div>";
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"]);
$disabled_module = db_get_value ("disabled", "tagente_modulo", "id_agente_modulo", $layoutData["id_agente_modulo"]);
if($delete_pending_module == 1 || $disabled_module == 1)
continue;
@ -270,6 +300,8 @@ foreach ($layoutDatas as $layoutData) {
html_print_input_hidden('status_'.$layoutData['id'], visual_map_get_status_element($layoutData));
}
echo "<img style='position: absolute; top: 0px; left: 0px;' id='background_img' src='images/console/background/" . $background . "' width='100%' height='100%' />";
echo '</div>';
echo '</div>';
@ -296,16 +328,20 @@ echo '<span style="display: none" id="message_alert_no_module">' . __('No module
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('ui.core');
ui_require_jquery_file('ui.resizable');
ui_require_jquery_file('colorpicker');
ui_require_jquery_file('ui.draggable');
ui_require_javascript_file('wz_jsgraphics');
ui_require_javascript_file('pandora_visual_console');
ui_require_jquery_file ('autocomplete');
//ui_require_jquery_file ('autocomplete');
ui_require_javascript_file('visual_console_builder.editor', 'godmode/reporting/');
// Javascript file for base 64 encoding of label parameter
ui_require_javascript_file ('encode_decode_base64');
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

View File

@ -26,6 +26,7 @@ enterprise_include_once ('include/functions_metaconsole.php');
// * q
// * id_group
$search_agents = (bool) get_parameter ('search_agents');
$search_agents_2 = (bool) get_parameter ('search_agents_2');
if ($search_agents && ($config['metaconsole'] == 0)) {
@ -115,5 +116,109 @@ elseif ($search_agents && ($config['metaconsole'] == 1)) {
return;
}
if ($search_agents_2 && ($config['metaconsole'] == 0)) {
require_once ('include/functions_agents.php');
$id_agent = (int) get_parameter ('id_agent');
$string = (string) get_parameter ('q'); /* q is what autocomplete plugin gives */
$id_group = (int) get_parameter('id_group', -1);
$addedItems = html_entity_decode((string) get_parameter('add'));
$addedItems = json_decode($addedItems);
$all = (string)get_parameter('all', 'all');
if ($addedItems != null) {
foreach ($addedItems as $item) {
echo $item . "|\n";
}
}
$filter = array ();
switch ($config['dbtype']) {
case "mysql":
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
break;
case "postgresql":
$filter[] = '(nombre LIKE \'%'.$string.'%\' OR direccion LIKE \'%'.$string.'%\' OR comentarios LIKE \'%'.$string.'%\')';
break;
case "oracle":
$filter[] = '(UPPER(nombre) LIKE UPPER(\'%'.$string.'%\') OR UPPER(direccion) LIKE UPPER(\'%'.$string.'%\') OR UPPER(comentarios) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
if ($id_group != -1)
$filter['id_grupo'] = $id_group;
switch ($all) {
case 'enabled':
$filter['disabled'] = 0;
break;
}
$agents = agents_get_agents ($filter, array ('id_agente', 'nombre', 'direccion'));
if ($agents === false)
$agents = array();
$data = array();
foreach ($agents as $agent) {
$data[] = array('id' => $agent['id_agente'], 'name' => io_safe_output($agent['nombre']), 'ip' => io_safe_output($agent['direccion']));
}
echo json_encode($data);
return;
}
elseif ($search_agents && ($config['metaconsole'] == 1)) {
$servers = db_get_all_rows_sql ("SELECT * FROM tmetaconsole_setup");
if (!isset($servers)) {
return;
}
foreach ($servers as $server) {
if (!metaconsole_load_external_db ($server)) {
continue;
}
$id_agent = (int) get_parameter ('id_agent');
$string = (string) get_parameter ('q'); /* q is what autocomplete plugin gives */
$id_group = (int) get_parameter('id_group');
$addedItems = html_entity_decode((string) get_parameter('add'));
$addedItems = json_decode($addedItems);
if ($addedItems != null) {
foreach ($addedItems as $item) {
echo $item . "|\n";
}
}
$filter = array ();
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
break;
case "oracle":
$filter[] = '(UPPER(nombre) LIKE UPPER(\'%'.$string.'%\') OR UPPER(direccion) LIKE UPPER(\'%'.$string.'%\') OR UPPER(comentarios) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$filter['id_grupo'] = $id_group;
$agents = agents_get_agents ($filter, array ('id_agente','nombre', 'direccion'));
if ($agents === false)
$agents = array();
$data = array();
foreach ($agents as $agent) {
$data[] = array('id' => $agent['id_agente'],
'name' => io_safe_output($agent['nombre']) . " (" . io_safe_output($server['server_name']) . ") ",
'ip' => io_safe_output($agent['direccion']));
}
//Restore db connection
metaconsole_restore_db();
echo json_encode($data);
}
return;
}
?>

View File

@ -58,6 +58,8 @@ $height_module_graph = get_parameter('height_module_graph', null);
$width_module_graph = get_parameter('width_module_graph', null);
$id_agent_module = get_parameter('id_agent_module', 0);
$process_simple_value = get_parameter('process_simple_value', 0);
$type_percentile = get_parameter('type_percentile', 'percentile');
$value_show = get_parameter('value_show', 'percent');
$get_element_status = get_parameter('get_element_status', 0);
$get_image_path_status = get_parameter('get_image_path_status', 0);
@ -84,40 +86,120 @@ switch ($action) {
echo json_encode($layoutData);
break;
case 'get_module_value':
$unit_text = false;
$layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element));
switch ($layoutData['type']){
switch ($layoutData['type']) {
case SIMPLE_VALUE_MAX:
$value = reporting_get_agentmodule_data_max ($layoutData['id_agente_modulo'], 86400, 0);
if ($value === false) {
$returnValue = __('Unknown');
} else {
}
else {
$returnValue = format_numeric ($value);
}
}
break;
case SIMPLE_VALUE_MIN:
$value = reporting_get_agentmodule_data_min ($layoutData['id_agente_modulo'], 86400, 0);
if ($value === false) {
$returnValue = __('Unknown');
} else {
}
else {
$returnValue = format_numeric ($value);
}
}
break;
case SIMPLE_VALUE_AVG:
$value = reporting_get_agentmodule_data_average ($layoutData['id_agente_modulo'], 86400, 0);
if ($value === false) {
$returnValue = __('Unknown');
} else {
}
else {
$returnValue = format_numeric ($value);
}
}
break;
case PERCENTILE_BAR:
case PERCENTILE_BUBBLE:
default:
$returnValue = db_get_sql ('SELECT datos FROM tagente_estado WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']);
if (($layoutData['type'] == PERCENTILE_BAR) ||
($layoutData['type'] == PERCENTILE_BUBBLE)) {
if ($value_show == 'value') {
$unit_text_db = db_get_sql ('SELECT unit FROM tagente_modulo WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']);
$unit_text_db = trim(io_safe_output($unit_text_db));
$unit_text = false;
if (!empty($unit_text_db))
$unit_text = $unit_text_db;
}
}
break;
}
// 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;
}
switch ($status) {
case 1:
//Critical (BAD)
$colorStatus = "#ff0000";
break;
case 4:
//Critical (ALERT)
$colorStatus = "#ff8800";
break;
case 0:
//Normal (OK)
$colorStatus = "#00ff00";
break;
case 2:
//Warning
$colorStatus = "#ffff00";
break;
case 3:
//Unknown
default:
$colorStatus = "#0000ff";
// Default is Grey (Other)
break;
}
$return = array();
$return['value'] = $returnValue;
$return['max_percentile'] = $layoutData['height'];
$return['width_percentile'] = $layoutData['width'];
$return['unit_text'] = $unit_text;
$return['colorRGB'] = implode('|', html_html2rgb($colorStatus));
echo json_encode($return);
break;
@ -151,6 +233,7 @@ switch ($action) {
break;
case 'simple_value':
case 'percentile_bar':
case 'percentile_item':
case 'static_graph':
case 'module_graph':
case 'label':
@ -162,7 +245,7 @@ switch ($action) {
if ($left !== null) {
$values['pos_x'] = $left;
}
if ($top !== null) {
if ($top !== null) {
$values['pos_y'] = $top;
}
if ($agent !== null) {
@ -193,12 +276,29 @@ switch ($action) {
$values['period'] = $period;
}
break;
case 'percentile_item':
case 'percentile_bar':
if ($width_percentile !== null) {
$values['width'] = $width_percentile;
}
if ($max_percentile !== null) {
$values['height'] = $max_percentile;
if ($action == 'update') {
if ($width_percentile !== null) {
$values['width'] = $width_percentile;
}
if ($max_percentile !== null) {
$values['height'] = $max_percentile;
}
$values['type'] = PERCENTILE_BAR;
if ($type_percentile == 'percentile') {
$values['type'] = PERCENTILE_BAR;
}
elseif ($type_percentile == 'bubble') {
$values['type'] = PERCENTILE_BUBBLE;
}
//Check the field's value for back compatibility
$values['image'] = 'percent';
if (($value_show == 'percent') ||
($value_show == 'value'))
$values['image'] = $value_show;
}
break;
case 'icon':
@ -232,6 +332,7 @@ switch ($action) {
echo json_encode($backgroundFields);
break;
case 'percentile_bar':
case 'percentile_item':
case 'static_graph':
case 'module_graph':
case 'simple_value':
@ -252,9 +353,23 @@ switch ($action) {
$elementFields['modules_html'] = '<option value="0">' . __('Any') . '</option>';
}
switch ($type) {
case 'percentile_item':
case 'percentile_bar':
$elementFields['width_percentile'] = $elementFields['width'];
$elementFields['max_percentile'] = $elementFields['height'];
//Check the field's value for back compatibility
$elementFields['value_show'] = 'percent';
if (($elementFields['image'] == 'percent') ||
($elementFields['image'] == 'value'))
$elementFields['value_show'] = $elementFields['image'];
$elementFields['type_percentile'] = 'percentile';
if ($elementFields['type'] == PERCENTILE_BAR) {
$elementFields['type_percentile'] = 'percentile';
}
elseif ($elementFields['type'] == PERCENTILE_BUBBLE) {
$elementFields['type_percentile'] = 'bubble';
}
break;
case 'module_graph':
$elementFields['width_module_graph'] = $elementFields['width'];
@ -272,10 +387,10 @@ switch ($action) {
break;
case SIMPLE_VALUE_MIN:
$elementFields['process_value'] = 1;
break;
break;
case SIMPLE_VALUE_AVG:
$elementFields['process_value'] = 3;
break;
break;
}
}
$elementFields['label'] = io_safe_output($elementFields['label']);
@ -306,8 +421,15 @@ switch ($action) {
$values['width'] = $width_module_graph;
$values['period'] = $period;
break;
case 'percentile_bar':
$values['type'] = PERCENTILE_BAR;
case 'percentile_item':
case 'percentile_bar':
if ($type_percentile == 'percentile') {
$values['type'] = PERCENTILE_BAR;
}
else {
$values['type'] = PERCENTILE_BUBBLE;
}
$values['image'] = $value_show; //Hack to save it show percent o value.
$values['width'] = $width_percentile;
$values['height'] = $max_percentile;
break;

View File

@ -904,7 +904,7 @@ function get_agent_modules($thrash1, $thrash2, $other, $thrash3) {
if (count($all_modules) > 0 and $all_modules !== false){
$data = array('type' => 'array', 'data' => $all_modules);
returnData('csv', $data, ';');
returnData('csv', $data, ';');
}
else {
returnError('error_agent_modules', 'No modules retrieved.');
@ -935,7 +935,7 @@ function get_group_agent($thrash1, $thrash2, $other, $thrash3) {
if (count($group_names) > 0 and $group_names !== false){
$data = array('type' => 'array', 'data' => $group_names);
returnData('csv', $data, ';');
returnData('csv', $data, ';');
}
else {
returnError('error_group_agent', 'No groups retrieved.');
@ -973,7 +973,7 @@ function get_policies($thrash1, $thrash2, $other, $thrash3) {
if (count($policies) > 0 and $policies !== false){
$data = array('type' => 'array', 'data' => $policies);
returnData('csv', $data, ';');
returnData('csv', $data, ';');
}
else {
returnError('error_get_policies', 'No policies retrieved.');
@ -1012,7 +1012,7 @@ function get_policy_modules($thrash1, $thrash2, $other, $thrash3) {
if (count($policies) > 0 and $policies !== false){
$data = array('type' => 'array', 'data' => $policies);
returnData('csv', $data, ';');
returnData('csv', $data, ';');
}
else {
returnError('error_policy_modules', 'No policy modules retrieved.');
@ -2019,7 +2019,7 @@ function get_module_value_all_agents($id, $thrash1, $other, $thrash2) {
else{
$data = array('type' => 'array', 'data' => $module_values);
returnData('csv', $data, ';');
returnData('csv', $data, ';');
}
}
@ -3312,9 +3312,10 @@ function set_apply_policy($id, $thrash1, $other, $thrash3) {
if ($duplicated === ENTERPRISE_NOT_HOOK) {
// We want to return a value
if ($other == "return"){
if ($other == "return") {
return -1;
}else{
}
else {
returnError('error_apply_policy', __('Error applying policy.'));
return;
}
@ -3322,9 +3323,10 @@ function set_apply_policy($id, $thrash1, $other, $thrash3) {
if ($duplicated == STATUS_IN_QUEUE_APPLYING or $duplicated == STATUS_IN_QUEUE_IN){
// We want to return a value
if ($other == "return"){
if ($other == "return") {
return -1;
}else{
}
else {
returnError('error_apply_policy', __('Error applying policy. This policy is already pending to apply.'));
return;
}
@ -3334,21 +3336,23 @@ function set_apply_policy($id, $thrash1, $other, $thrash3) {
if ($id === ENTERPRISE_NOT_HOOK) {
// We want to return a value
if ($other == "return"){
if ($other == "return") {
return -1;
}else{
}
else {
returnError('error_apply_policy', __('Error applying policy.'));
return;
}
}
// We want to return a value
if ($other == "return"){
if ($other == "return") {
if ($id)
return $id;
else
return -1;
} else {
}
else {
if ($id)
returnData('string', array('type' => 'string', 'data' => $id));
else

View File

@ -18,7 +18,7 @@ include_once($config["homedir"] . "/include/graphs/fgraph.php");
include_once($config["homedir"] . "/include/functions_reporting.php");
include_once($config['homedir'] . "/include/functions_agents.php");
include_once($config['homedir'] . "/include/functions_modules.php");
include_once($config['homedir'] . '/include/functions_users.php');
include_once($config['homedir'] . "/include/functions_users.php");
define("GRAPH_AREA", 0);
define("GRAPH_STACKED_AREA", 1);
@ -399,7 +399,7 @@ function graph_get_formatted_date($timestamp, $format1, $format2) {
}
}
return $date;
return $date;
}
/**
@ -490,7 +490,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
// interval - This is the number of "rows" we are divided the time to fill data.
// more interval, more resolution, and slower.
// periodo - Gap of time, in seconds. This is now to (now-periodo) secs
// Init weights
for ($i = 0; $i < $module_number; $i++) {
if (! isset ($weight_list[$i])) {
@ -721,7 +721,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
$graph_values[$i] = $temp_graph_values;
}
}
//Add the max, min and avg in the legend
$avg = round($avg / $countAvg, 1);
@ -934,17 +934,58 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
$config['fontpath'], $config['font_size']);
}
function progress_bar($progress, $width, $height, $title = '', $mode = 1) {
function progress_bar($progress, $width, $height, $title = '', $mode = 1, $value_text = false, $color = false) {
global $config;
$out_of_lim_str = __("Out of limits");
$title = "";
if ($value_text === false) {
$value_text = $progress . "%";
}
$colorRGB = '';
if ($color !== false) {
$colorRGB = html_html2rgb($color);
$colorRGB = implode('|', $colorRGB);
}
require_once("include_graph_dependencies.php");
include_graphs_dependencies($config['homedir'].'/');
return "<img title='" . $title . "' alt='" . $title . "'" .
" src='include/graphs/fgraph.php?homeurl=../../&graph_type=progressbar" .
"&width=".$width."&height=".$height."&progress=".$progress.
"&mode=" . $mode . "&out_of_lim_str=".$out_of_lim_str .
"&title=".$title."&font=".$config['fontpath']."&value_text=". $value_text .
"&colorRGB=". $colorRGB . "' />";
}
return "<img title='" . $title . "' alt='" . $title . "' src='include/graphs/fgraph.php?static_graph=1&homeurl=../../&graph_type=progressbar&width=".$width."&height=".$height."&progress=".$progress.
"&mode=" . $mode . "&out_of_lim_str=".$out_of_lim_str."&title=".$title."&font=".$config['fontpath']."' />";
function progress_bubble($progress, $width, $height, $title = '', $mode = 1, $value_text = false, $color = false) {
global $config;
$out_of_lim_str = __("Out of limits");
$title = "";
if ($value_text === false) {
$value_text = $progress . "%";
}
$colorRGB = '';
if ($color !== false) {
$colorRGB = html_html2rgb($color);
$colorRGB = implode('|', $colorRGB);
}
require_once("include_graph_dependencies.php");
include_graphs_dependencies($config['homedir'].'/');
return "<img title='" . $title . "' alt='" . $title . "'" .
" src='include/graphs/fgraph.php?homeurl=../../&graph_type=progressbubble" .
"&width=".$width."&height=".$height."&progress=".$progress.
"&mode=" . $mode . "&out_of_lim_str=".$out_of_lim_str .
"&title=".$title."&font=".$config['fontpath']."&value_text=". $value_text .
"&colorRGB=". $colorRGB . "' />";
}
function graph_sla_slicebar ($id, $period, $sla_min, $sla_max, $date, $daysWeek = null, $time_from = null, $time_to = null, $width, $height, $home_url) {
@ -1838,7 +1879,8 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
if (empty($unit_name)){
$unit = modules_get_unit($agent_module_id);
}else
}
else
$unit = $unit_name;
// Data iterator
@ -1954,7 +1996,7 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
//$chart[$timestamp]['count'] = 0;
//$chart[$timestamp]['timestamp_bottom'] = $timestamp;
//$chart[$timestamp]['timestamp_top'] = $timestamp + $interval;
if (!$avg_only){
if (!$avg_only) {
$chart[$timestamp]['min'] = 0;
$chart[$timestamp]['max'] = 0;
}
@ -2411,7 +2453,7 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
}
}
if (empty($unit_name)){
if (empty($unit_name)) {
$unit = modules_get_unit($agent_module_id);
}
else

View File

@ -1047,7 +1047,7 @@ function html_print_radio_button ($name, $value, $label = '', $checkedvalue = ''
if ($return)
return $output;
echo $output;
}

View File

@ -810,7 +810,9 @@ function ui_require_css_file ($name, $path = 'include/styles/') {
return true;
if (! file_exists ($filename) && ! file_exists ($config['homedir'].'/'.$filename))
return false;
$config['css'][$name] = $filename;
return true;
}
@ -1008,7 +1010,8 @@ function ui_process_page_head ($string, $bitfield) {
$output .= '<script type="text/javascript">/* <![CDATA[ */'."\n";
$output .= file_get_contents ($config["homedir"]."/".$filename);
$output .= "\n".'/* ]]> */</script>';
} else {
}
else {
$output .= '<script type="text/javascript" src="'.$filename.'"></script>'."\n\t";
}
}
@ -1020,13 +1023,22 @@ function ui_process_page_head ($string, $bitfield) {
}
//Pandora specific jquery should go first
$config['jquery'] = array_merge (array ("jquery" => "include/javascript/jquery.js",
"pandora" => "include/javascript/jquery.pandora.js"),
$black_list_pages_old_jquery = array('operation/gis_maps/index');
if (in_array(get_parameter('sec2'), $black_list_pages_old_jquery)) {
$config['jquery'] = array_merge (array ("jquery" => "include/javascript/jquery.js",
"pandora" => "include/javascript/jquery.pandora.js"),
$config['jquery']);
}
else {
$config['jquery'] = array_merge (array ("jquery" => "include/javascript/jquery-1.7.1.min.js",
"pandora" => "include/javascript/jquery.pandora.js"),
$config['jquery']);
}
//Then add each script as necessary
$loaded = array ('');
foreach ($config['jquery'] as $name => $filename) {
if (in_array ($name, $loaded))
continue;
@ -1036,7 +1048,8 @@ function ui_process_page_head ($string, $bitfield) {
$output .= '<script type="text/javascript">/* <![CDATA[ */'."\n";
$output .= file_get_contents ($config["homedir"]."/".$filename);
$output .= "\n".'/* ]]> */</script>';
} else {
}
else {
$output .= '<script type="text/javascript" src="'.$filename.'"></script>'."\n\t";
}
}

View File

@ -98,11 +98,69 @@ 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;
}
switch ($status) {
case 1:
//Critical (BAD)
$colorStatus = "#ff0000";
break;
case 4:
//Critical (ALERT)
$colorStatus = "#ff8800";
break;
case 0:
//Normal (OK)
$colorStatus = "#00ff00";
break;
case 2:
//Warning
$colorStatus = "#ffff00";
break;
case 3:
//Unknown
default:
$colorStatus = "#0000ff";
// Default is Blue (Other)
break;
}
switch ($type) {
case STATIC_GRAPH:
if ($layoutData['image'] != null) {
$img = visual_map_get_image_status_element($layoutData);
if(substr($img,0,1) == '4') {
if (substr($img,0,1) == '4') {
$borderStyle ='border: 2px solid #ffa300;';
$img = substr_replace($img, '', 0,1);
}
@ -112,7 +170,7 @@ function visual_map_print_item($layoutData) {
$sizeStyle = 'width: ' . $width . 'px; height: ' . $height . 'px;';
$imageSize = 'width="' . $width . '" height="' . $height . '"';
}
echo '<div id="' . $id . '" class="item static_graph" style="left: 0px; top: 0px; text-align: center; color: ' . $color . '; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
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;">';
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));
@ -124,16 +182,41 @@ function visual_map_print_item($layoutData) {
echo "</div>";
break;
case PERCENTILE_BAR:
case PERCENTILE_BUBBLE:
$module_value = db_get_sql ('SELECT datos FROM tagente_estado WHERE id_agente_modulo = ' . $id_module);
$value_text = false;
if ($layoutData['image'] == 'percent') {
$value_text = false;
}
elseif ($layoutData['image'] == 'value') {
$unit_text = db_get_sql ('SELECT unit FROM tagente_modulo WHERE id_agente_modulo = ' . $id_module);
$unit_text = trim(io_safe_output($unit_text));
$value_text = $module_value;
if (!empty($unit_text))
$value_text .= " " . $unit_text;
}
if ( $max_percentile > 0)
$percentile = $module_value / $max_percentile * 100;
else
$percentile = 100;
echo '<div id="' . $id . '" class="item percentile_bar" style="left: 0px; top: 0px; color: ' . $color . '; text-align: center; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
$percentile = round($percentile);
echo '<div id="' . $id . '" class="item percentile_item" style="left: 0px; top: 0px; color: ' . $color . '; text-align: center; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
echo $text . '<br />';
echo progress_bar($percentile, $width, 15);
ob_start();
if ($type == PERCENTILE_BUBBLE) {
echo progress_bubble($percentile, $width, $width, '', 1, $value_text, $colorStatus);
}
else {
echo progress_bar($percentile, $width, 15, '', 1, $value_text, $colorStatus);
}
$img = ob_get_clean();
$img = str_replace('>', 'class="image" id="image_' . $id . '" />', $img);
echo $img;
echo '</div>';
break;
@ -142,7 +225,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="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 module_graph" style="left: 0px; top: 0px; color: ' . $color . '; text-align: center; position: absolute; display: inline-block; ' . $sizeStyle . ' top: ' . $top . 'px; left: ' . $left . 'px;">';
echo $text . '<br />';
echo $img;
echo '</div>';
@ -151,7 +234,7 @@ 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="left: 0px; top: 0px; color: ' . $color . '; text-align: center; position: absolute; display: inline-block; ' . $sizeStyle . ' top: ' . $top . 'px; left: ' . $left . 'px;">';
echo $text;
switch ($type){
case SIMPLE_VALUE:
@ -188,7 +271,7 @@ function visual_map_print_item($layoutData) {
echo '</div>';
break;
case LABEL:
echo '<div id="' . $id . '" class="item label" style="left: 0px; top: 0px; text-align: center; color: ' . $color . '; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
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 $text;
echo "</div>";
break;
@ -201,7 +284,7 @@ function visual_map_print_item($layoutData) {
$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; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
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;">';
if ($layoutData['image'] != null) {
// If match with protocol://direction
if (preg_match('/^(http:\/\/)((.)+)$/i', $text)){
@ -453,6 +536,7 @@ function visual_map_get_status_element($layoutData) {
* @param bool $draw_lines
*/
function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_lines = true, $width = null, $height = null) {
//TODO: USE THE SAME CODE THAT THE VISUAL MAP EDITOR
global $config;
$layout = db_get_row ('tlayout', 'id', $id_layout);
@ -517,48 +601,56 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
elseif ($id_layout_linked != 0) {
$status_parent = visual_map_get_layout_status ($id_layout_linked);
}
else {
$status_parent = 3;
}
} else {
}
else {
$id_agent_module_parent = 0;
$status_parent = 3;
}
// ****************************************************************
// Get STATUS of current object
// ****************************************************************
// Linked to other layout ?? - Only if not module defined
if ($layout_data['id_layout_linked'] != 0) {
$status = visual_map_get_layout_status ($layout_data['id_layout_linked']);
// Single object
} elseif ($layout_data["type"] == 0) {
}
elseif (($layout_data["type"] == 0)
|| ($layout_data["type"] == 3)
|| ($layout_data["type"] == 9)
|| ($layout_data["type"] == 4)) {
// Status for a simple module
if ($layout_data['id_agente_modulo'] != 0) {
$status = modules_get_agentmodule_status ($layout_data['id_agente_modulo']);
$id_agent = db_get_value ("id_agente", "tagente_estado", "id_agente_modulo", $layout_data['id_agente_modulo']);
// Status for a whole agent, if agente_modulo was == 0
} elseif ($layout_data['id_agent'] != 0) {
}
elseif ($layout_data['id_agent'] != 0) {
$status = agents_get_status ($layout_data["id_agent"]);
if ($status == -1) // agents_get_status return -1 for unknown!
$status = 3;
$id_agent = $layout_data["id_agent"];
} else {
}
else {
$status = 3;
$id_agent = 0;
}
} else {
}
else {
// If it's a graph, a progress bar or a data tag, ALWAYS report
// status OK (=0) to avoid confussions here.
$status = 0;
}
// ****************************************************************
// STATIC IMAGE (type = 0)
// ****************************************************************
@ -582,10 +674,10 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
if (!isset ($id_agent))
$id_agent = 0;
if ($show_links) {
if (($id_agent > 0) && ($layout_data['id_layout_linked'] == "" || $layout_data['id_layout_linked'] == 0)) {
//Extract id service if it is a prediction module.
$id_service = db_get_value_filter('custom_integer_1',
'tagente_modulo',
@ -605,12 +697,14 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
// Link to an agent
echo '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'">';
}
} elseif ($layout_data['id_layout_linked'] > 0) {
}
elseif ($layout_data['id_layout_linked'] > 0) {
// Link to a map
echo '<a href="index.php?sec=visualc&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
} else {
}
else {
// A void object
echo '<a href="#">';
}
@ -649,6 +743,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
default:
$img .= ".png";
// Default is Grey (Other)
break;
}
$borderStyle = '';
if(substr($img,0,1) == '4') {
@ -678,7 +773,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$img_style["height"] = (integer)($proportion * $infoImage[1]);
html_print_image ($img, false, $img_style);
echo "</a>";
// Print label if valid label_color (only testing for starting with #) otherwise print nothing
@ -688,7 +783,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
}
echo "</div>";
}
switch ($layout_data['type']) {
case 4:
// ****************************************************************
@ -750,22 +845,22 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$endTagA = true;
}
}
$img_style = array ();
$img_style["title"] = $layout_data["label"];
if (!empty ($layout_data["width"])) {
$img_style["width"] = $layout_data["width"];
}
if (!empty ($layout_data["height"])) {
$img_style["height"] = $layout_data["height"];
}
$img = "images/console/icons/".$layout_data["image"] . ".png";
if (is_file($img))
$infoImage = getimagesize($img);
if (!empty ($layout_data["width"])) {
if ($resizedMap)
$img_style["width"] = (integer)($proportion * $layout_data["width"]);
@ -774,7 +869,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
}
else
$img_style["width"] = (integer)($proportion * $infoImage[0]);
if (!empty ($layout_data["height"])) {
if ($resizedMap)
$img_style["height"] = (integer)($proportion * $img_style["height"]);
@ -783,7 +878,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
}
else
$img_style["height"] = (integer)($proportion * $infoImage[1]);
html_print_image ($img, false, $img_style);
if ($endTagA) echo "</a>";
@ -810,7 +905,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
'tagente_modulo',
array('id_agente_modulo' => $layout_data['id_agente_modulo'],
'prediction_module' => 1));
if ($id_service === false) {
$id_service = 0;
}
@ -822,13 +917,13 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$endTagA = true;
}
elseif ($layout_data['id_layout_linked'] > 0) {
// Link to a map
echo '<a href="index.php?sec=visualc&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
$endTagA = true;
}
}
echo '<strong>'.$layout_data['label']. ' ';
//TODO: change interface to add a period parameter, now is set to 1 day
switch ($layout_data['type']){
@ -868,11 +963,41 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
if ($endTagA) echo '</a>';
echo '</div>';
break;
break;
case 3:
// ****************************************************************
// Progress bar
// ****************************************************************
case 9:
// ****************************************************************
// Progress bubble
// ****************************************************************
switch ($status) {
case 1:
//Critical (BAD)
$colorStatus = "#ff0000";
break;
case 4:
//Critical (ALERT)
$colorStatus = "#ff8800";
break;
case 0:
//Normal (OK)
$colorStatus = "#00ff00";
break;
case 2:
//Warning
$colorStatus = "#ffff00";
break;
case 3:
//Unknown
default:
$colorStatus = "#0000ff";
// Default is Grey (Other)
break;
}
if ($resizedMap)
echo '<div style="left: 0px; top: 0px; text-align: center; z-index: 1; color: '.$layout_data['label_color'].'; position: absolute; margin-left: '.((integer)($proportion *$layout_data['pos_x'])).'px; margin-top:'.((integer)($proportion *$layout_data['pos_y'])).'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">';
else
@ -883,41 +1008,74 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$percentile = $valor / $layout_data['height'] * 100;
else
$percentile = 100;
$percentile = round($percentile);
$endTagA = false;
if ($show_links) {
//Extract id service if it is a prediction module.
$id_service = db_get_value_filter('custom_integer_1',
'tagente_modulo',
array('id_agente_modulo' => $layout_data['id_agente_modulo'],
'prediction_module' => 1));
if ($id_service === false) {
$id_service = 0;
}
if ($id_service != 0) {
//Link to an service page
echo '<a href="index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">';
$endTagA = true;
}
elseif ($layout_data['id_layout_linked'] > 0) {
// Link to a map
echo '<a href="index.php?sec=visualc&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
$endTagA = true;
}
}
echo $layout_data['label'];
echo "<br>";
if ($resizedMap)
echo progress_bar($percentile, ((integer)($proportion * $width)), 15);
else
echo progress_bar($percentile, $width, 15);
if ($show_links) {
if (($id_agent > 0) && ($layout_data['id_layout_linked'] == "" || $layout_data['id_layout_linked'] == 0)) {
//Extract id service if it is a prediction module.
$id_service = db_get_value_filter('custom_integer_1',
'tagente_modulo',
array('id_agente_modulo' => $layout_data['id_agente_modulo'],
'prediction_module' => 1));
if ($id_service === false) {
$id_service = 0;
}
if ($id_service != 0) {
//Link to an service page
echo '<a href="index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">';
}
else {
// Link to an agent
echo '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'">';
}
}
elseif ($layout_data['id_layout_linked'] > 0) {
// Link to a map
echo '<a href="index.php?sec=visualc&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
}
else {
// A void object
echo '<a href="#">';
}
}
$value_text = false;
if ($layout_data['image'] == 'percent') {
$value_text = false;
}
elseif ($layout_data['image'] == 'value') {
$unit_text = db_get_sql ('SELECT unit FROM tagente_modulo WHERE id_agente_modulo = ' . $layout_data['id_agente_modulo']);
$unit_text = trim(io_safe_output($unit_text));
$value_text = $valor;
if (!empty($unit_text))
$value_text .= " " . $unit_text;
}
if ($layout_data['type'] == 9) {
if ($resizedMap)
echo progress_bubble($percentile, ((integer)($proportion * $width)), $width, '', 1, $value_text, $colorStatus);
else
echo progress_bubble($percentile, $width, $width, '', 1, $value_text, $colorStatus);
}
else {
if ($resizedMap)
echo progress_bar($percentile, ((integer)($proportion * $width)), 15, '', 1, $value_text, $colorStatus);
else
echo progress_bar($percentile, $width, 15, '', 1, $value_text, $colorStatus);
}
if ($endTagA) echo '</a>';
@ -935,18 +1093,18 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
echo $layout_data['label'];
echo "<br>";
$endTagA = false;
if ($show_links) {
if (($layout_data['id_layout_linked'] == "") || ($layout_data['id_layout_linked'] == 0)) {
//Extract id service if it is a prediction module.
$id_service = db_get_value_filter('custom_integer_1',
'tagente_modulo',
array('id_agente_modulo' => $layout_data['id_agente_modulo'],
'prediction_module' => 1));
if ($id_service === false) {
$id_service = 0;
}

View File

@ -81,7 +81,7 @@ switch($graph_type) {
$height = get_parameter('height');
$font = get_parameter('font');
$data = json_decode(io_safe_output(get_parameter('data')), true);
$max = get_parameter('max');
$title = get_parameter('title');
$mode = get_parameter ('mode', 1);
@ -94,13 +94,40 @@ switch($graph_type) {
$out_of_lim_str = get_parameter('out_of_lim_str', false);
$out_of_lim_image = get_parameter('out_of_lim_image', false);
$font = get_parameter('font');
$title = get_parameter('title');
$mode = get_parameter('mode', 1);
gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode);
$fontsize = get_parameter('fontsize', 10);
$value_text = get_parameter('value_text', '');
$colorRGB = get_parameter('colorRGB', '');
gd_progress_bar ($width, $height, $progress, $title, $font,
$out_of_lim_str, $out_of_lim_image, $mode, $fontsize, $value_text, $colorRGB);
break;
case 'progressbubble':
$width = get_parameter('width');
$height = get_parameter('height');
$progress = get_parameter('progress');
$out_of_lim_str = get_parameter('out_of_lim_str', false);
$out_of_lim_image = get_parameter('out_of_lim_image', false);
$font = get_parameter('font');
$title = get_parameter('title');
$mode = get_parameter('mode', 1);
$fontsize = get_parameter('fontsize', 7);
$value_text = get_parameter('value_text', '');
$colorRGB = get_parameter('colorRGB', '');
gd_progress_bubble ($width, $height, $progress, $title, $font,
$out_of_lim_str, $out_of_lim_image, $mode, $fontsize, $value_text, $colorRGB);
break;
}

View File

@ -47,26 +47,37 @@ if($id_graph && in_array($graph_type, $types)) {
switch($graph_type) {
case 'histogram':
gd_histogram ($graph['width'],
$graph['height'],
$graph['mode'],
json_decode($graph['data'], true),
$graph['max'],
$graph['font'],
$graph['title'],
$graph['fontsize']);
break;
case 'progressbar':
gd_progress_bar ($graph['width'],
$graph['height'],
$graph['progress'],
$graph['title'],
$graph['font'],
$graph['out_of_lim_str'],
$graph['out_of_lim_image'],
$graph['mode'],
$graph['fontsize']);
break;
gd_histogram ($graph['width'],
$graph['height'],
$graph['mode'],
json_decode($graph['data'], true),
$graph['max'],
$graph['font'],
$graph['title'],
$graph['fontsize']);
break;
case 'progressbar':
gd_progress_bar ($graph['width'],
$graph['height'],
$graph['progress'],
$graph['title'],
$graph['font'],
$graph['out_of_lim_str'],
$graph['out_of_lim_image'],
$graph['mode'],
$graph['fontsize']);
break;
case 'progressbubble':
gd_progress_bubble ($graph['width'],
$graph['height'],
$graph['progress'],
$graph['title'],
$graph['font'],
$graph['out_of_lim_str'],
$graph['out_of_lim_image'],
$graph['mode'],
$graph['fontsize']);
break;
}
}
@ -145,10 +156,9 @@ function gd_histogram ($width, $height, $mode, $data, $max_value, $font, $title,
}
// ***************************************************************************
// Draw a dynamic progress bar using GDlib directly
// Draw a dynamic progress bubble using GDlib directly
// ***************************************************************************
function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode = 1, $fontsize=10) {
function gd_progress_bubble ($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode = 1, $fontsize=10, $value_text = '', $colorRGB = '') {
if($out_of_lim_str === false) {
$out_of_lim_str = "Out of limits";
}
@ -157,11 +167,98 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
$out_of_lim_image = "images_graphs/outlimits.png";
}
$color = array();
if (!empty($colorRGB)) {
$color = explode('|', $colorRGB);
}
Header("Content-type: image/png");
switch ($mode)
{
//TODO: Understand the difernets between the modes.
case 0:
case 1:
case 2:
global $config;
global $REMOTE_ADDR;
$ratingWidth = ($progress/100)*$width;
$ratingHeight = ($progress/100)*$height;
$image = imagecreate($width,$height);
//colors
$back = ImageColorAllocate($image,255,255,255);
imagecolortransparent ($image, $back);
$black = ImageColorAllocate($image,0,0,0);
$red = ImageColorAllocate($image,255,60,75);
$green = ImageColorAllocate($image,50,205,50);
$blue = ImageColorAllocate($image,44,81,120);
$soft_green = ImageColorAllocate($image,176, 255, 84);
$soft_yellow = ImageColorAllocate($image,255, 230, 84);
$soft_red = ImageColorAllocate($image,255, 154, 84);
$other_red = ImageColorAllocate($image,238, 0, 0);
if (!empty($color)) {
$defined_color = ImageColorAllocate($image, $color[0], $color[1], $color[2]);
}
if (isset($defined_color)) {
imagefilledellipse($image, $width / 2, $height / 2,
$ratingWidth, $ratingHeight, $defined_color);
}
elseif ($rating > 70) {
imagefilledellipse($image, $width / 2, $height / 2,
$ratingWidth, $ratingHeight, $soft_green);
}
elseif ($rating > 50) {
imagefilledellipse($image, $width / 2, $height / 2,
$ratingWidth, $ratingHeight, $soft_yellow);
}
elseif ($rating > 30) {
imagefilledellipse($image, $width / 2, $height / 2,
$ratingWidth, $ratingHeight, $soft_red);
}
else if($rating > 0) {
imagefilledellipse($image, $width / 2, $height / 2,
$ratingWidth, $ratingHeight, $other_red);
}
//Write the value
$size = imagettfbbox ($fontsize, 0, $font, $value_text);
ImageTTFText($image, $fontsize, 0,
($width/2) - ($size[4] / 2), ($height/2) + ($size[1] / 2), $black, $font, $value_text);
imagePNG($image);
imagedestroy($image);
break;
}
}
// ***************************************************************************
// Draw a dynamic progress bar using GDlib directly
// ***************************************************************************
function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode = 1, $fontsize=10, $value_text = '', $colorRGB = '') {
if($out_of_lim_str === false) {
$out_of_lim_str = "Out of limits";
}
if($out_of_lim_image === false) {
$out_of_lim_image = "images_graphs/outlimits.png";
}
$color = array();
if (!empty($colorRGB)) {
$color = explode('|', $colorRGB);
}
// Copied from the PHP manual:
// http://us3.php.net/manual/en/function.imagefilledrectangle.php
// With some adds from sdonie at lgc dot com
// Get from official documentation PHP.net website. Thanks guys :-)
function drawRating($rating, $width, $height, $font, $out_of_lim_str, $mode, $fontsize) {
function drawRating($rating, $width, $height, $font, $out_of_lim_str, $mode, $fontsize, $value_text, $color) {
global $config;
global $REMOTE_ADDR;
@ -179,14 +276,14 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
if ($height == 0) {
$height = 20;
}
//$rating = $_GET['rating'];
$ratingbar = (($rating/100)*$width)-2;
$ratingbar30 = ((30/100)*$width)-2;
$image = imagecreate($width,$height);
//colors
$back = ImageColorAllocate($image,255,255,255);
imagecolortransparent ($image, $back);
@ -195,12 +292,15 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
$red = ImageColorAllocate($image,255,60,75);
$green = ImageColorAllocate($image,50,205,50);
$blue = ImageColorAllocate($image,44,81,120);
if (!empty($color)) {
$defined_color = ImageColorAllocate($image, $color[0], $color[1], $color[2]);
}
$soft_green = ImageColorAllocate($image,176, 255, 84);
$soft_yellow = ImageColorAllocate($image,255, 230, 84);
$soft_red = ImageColorAllocate($image,255, 154, 84);
$other_red = ImageColorAllocate($image,238, 0, 0);
ImageRectangleWithRoundedCorners($image,0,0,$width-1,$height-1,$radius,$back,false);
$x1 = 1;
@ -211,7 +311,10 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
switch ($mode)
{
case 0:
if ($rating > 70)
if (isset($defined_color)) {
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius, $defined_color);
}
elseif ($rating > 70)
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius, $soft_green);
elseif ($rating > 50)
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius, $soft_yellow);
@ -225,7 +328,10 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
}
break;
case 1:
if ($rating > 100)
if (isset($defined_color)) {
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius,$defined_color);
}
elseif ($rating > 100)
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius,$red);
elseif ($rating == 100)
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius,$green);
@ -240,12 +346,15 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
if ($rating > 100)
ImageTTFText($image, $fontsize, 0, ($width/4), ($height/2)+($height/5), $back, $font, $out_of_lim_str);
else
ImageTTFText($image, $fontsize, 0, ($width/2)-($width/10), ($height/2)+($height/5), $back, $font, $rating."%");
ImageTTFText($image, $fontsize, 0, ($width/2)-($width/10), ($height/2)+($height/5), $back, $font, $value_text);
else
ImageTTFText($image, $fontsize, 0, ($width/2)-($width/10), ($height/2)+($height/5), $text, $font, $rating."%");
ImageTTFText($image, $fontsize, 0, ($width/2)-($width/10), ($height/2)+($height/5), $text, $font, $value_text);
break;
case 2:
if ($rating > 70)
if (isset($defined_color)) {
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius, $defined_color);
}
elseif ($rating > 70)
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius, $other_red);
elseif ($rating > 50)
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius, $soft_red);
@ -267,19 +376,19 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
imageline($image, $x1+$radius, $y2, $x2-$radius, $y2, $bordercolor);
imageline($image, $x1, $y1+$radius, $x1, $y2-$radius, $bordercolor);
imageline($image, $x2, $y1+$radius, $x2, $y2-$radius, $bordercolor);
imagearc($image,$x1+$radius, $y1+$radius, $radius*2, $radius*2, 180 , 270, $bordercolor);
imagearc($image,$x2-$radius, $y1+$radius, $radius*2, $radius*2, 270 , 360, $bordercolor);
imagearc($image,$x1+$radius, $y2-$radius, $radius*2, $radius*2, 90 , 180, $bordercolor);
imagearc($image,$x2-$radius, $y2-$radius, $radius*2, $radius*2, 360 , 90, $bordercolor);
}
imagePNG($image);
imagedestroy($image);
}
}
function ImageRectangleWithRoundedCorners(&$im, $x1, $y1, $x2, $y2, $radius, $color)
{
// Draw rectangle without corners
@ -292,57 +401,38 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
ImageFilledEllipse($im, $x1+$radius, $y2-$radius, $radius*2, $radius*2, $color);
ImageFilledEllipse($im, $x2-$radius, $y2-$radius, $radius*2, $radius*2, $color);
}
Header("Content-type: image/png");
switch ($mode)
{
case 0:
drawRating($progress, $width, $height, $font, $out_of_lim_str, $mode, $fontsize);
/*
if ($mode == 0) {
$engine->background_color = '#E6E6D2';
$engine->show_title = false;
if ($progress > 70)
$color = '#B0FF54';
elseif ($progress > 50)
$color = '#FFE654';
elseif ($progress > 30)
$color = '#FF9A54';
else
$color = '#EE0000';
} else {
$engine->background_color = '#FFFFFF';
$engine->show_title = true;
$engine->title = format_numeric ($progress).' %';
$color = '#2C5196';
Header("Content-type: image/png");
switch ($mode)
{
case 0:
drawRating($progress, $width, $height, $font, $out_of_lim_str, $mode, $fontsize, $value_text, $color);
break;
case 1:
if ($progress > 100 || $progress < 0) {
// HACK: This report a static image... will increase render in about 200% :-) useful for
// high number of realtime statusbar images creation (in main all agents view, for example
$imgPng = imageCreateFromPng($out_of_lim_image);
imageAlphaBlending($imgPng, true);
imageSaveAlpha($imgPng, true);
imagePng($imgPng);
}
else
drawRating($progress, $width, $height, $font, $out_of_lim_str, $mode, 6, $value_text, $color);
break;
case 2:
if ($progress > 100 || $progress < 0) {
// HACK: This report a static image... will increase render in about 200% :-) useful for
// high number of realtime statusbar images creation (in main all agents view, for example
$imgPng = imageCreateFromPng($out_of_lim_image);
imageAlphaBlending($imgPng, true);
imageSaveAlpha($imgPng, true);
imagePng($imgPng);
}
else
drawRating($progress, $width, $height, $font, $out_of_lim_str, $mode, 6, $value_text, $color);
break;
}
*/
break;
case 1:
if ($progress > 100 || $progress < 0) {
// HACK: This report a static image... will increase render in about 200% :-) useful for
// high number of realtime statusbar images creation (in main all agents view, for example
$imgPng = imageCreateFromPng($out_of_lim_image);
imageAlphaBlending($imgPng, true);
imageSaveAlpha($imgPng, true);
imagePng($imgPng);
}
else
drawRating($progress, $width, $height, $font, $out_of_lim_str, $mode, 6);
break;
case 2:
if ($progress > 100 || $progress < 0) {
// HACK: This report a static image... will increase render in about 200% :-) useful for
// high number of realtime statusbar images creation (in main all agents view, for example
$imgPng = imageCreateFromPng($out_of_lim_image);
imageAlphaBlending($imgPng, true);
imageSaveAlpha($imgPng, true);
imagePng($imgPng);
}
else
drawRating($progress, $width, $height, $font, $out_of_lim_str, $mode, 6);
break;
}
}
?>

View File

@ -79,9 +79,9 @@ function hl_bal($t, $do=1, $in='div'){
$ok = $q = array(); // $q seq list of open non-empty ele
$o = "";
for($i=-1, $ci=count($t); ++$i<$ci;){
for($i=-1, $ci=count($t); ++$i<$ci;) {
// allowed $ok in parent $p
if($ql = count($q)){
if($ql = count($q)) {
$p = array_pop($q);
$q[] = $p;
if(isset($cS[$p])){$ok = $cS[$p];}
@ -90,7 +90,10 @@ function hl_bal($t, $do=1, $in='div'){
elseif(isset($cB[$p])){$ok = $eB; unset($cI['del'], $cI['ins']);}
if(isset($cO[$p])){$ok = $ok + $cO[$p];}
if(isset($cN[$p])){$ok = array_diff_assoc($ok, $cN[$p]);}
}else{$ok = $inOk; unset($cI['del'], $cI['ins']);}
}
else {
$ok = $inOk; unset($cI['del'], $cI['ins']);
}
// bad tags, & ele content
if(isset($e) && ($do == 1 or (isset($ok['#pcdata']) && ($do == 3 or $do == 5)))){
$o .= '&lt;'.$s.$e.$a.'&gt;';
@ -101,7 +104,10 @@ function hl_bal($t, $do=1, $in='div'){
foreach(preg_split('`(\x01\x02[^\x01\x02]+\x02\x01)`', $x, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY) as $v){
$o .= (substr($v, 0, 2) == "\x01\x02" ? $v : ($do > 4 ? preg_replace('`\S`', '', $v) : ''));
}
}elseif($do > 4){$o .= preg_replace('`\S`', '', $x);}
}
elseif ($do > 4) {
$o .= preg_replace('`\S`', '', $x);
}
}
// get markup
if(!preg_match('`^(/?)([a-zA-Z1-6]+)([^>]*)>(.*)`sm', $t[$i], $r)){$x = $t[$i]; continue;}
@ -177,7 +183,9 @@ function hl_bal($t, $do=1, $in='div'){
elseif(isset($cB[$p])){$ok = $eB; unset($cI['del'], $cI['ins']);}
if(isset($cO[$p])){$ok = $ok + $cO[$p];}
if(isset($cN[$p])){$ok = array_diff_assoc($ok, $cN[$p]);}
}else{$ok = $inOk; unset($cI['del'], $cI['ins']);}
}
else {
$ok = $inOk; unset($cI['del'], $cI['ins']);}
if(isset($e) && ($do == 1 or (isset($ok['#pcdata']) && ($do == 3 or $do == 5)))){
$o .= '&lt;'.$s.$e.$a.'&gt;';
}
@ -190,7 +198,8 @@ function hl_bal($t, $do=1, $in='div'){
foreach(preg_split('`(\x01\x02[^\x01\x02]+\x02\x01)`', $x, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY) as $v){
$o .= (substr($v, 0, 2) == "\x01\x02" ? $v : ($do > 4 ? preg_replace('`\S`', '', $v) : ''));
}
}elseif($do > 4){$o .= preg_replace('`\S`', '', $x);}
}
elseif($do > 4){$o .= preg_replace('`\S`', '', $x);}
}
while(!empty($q) && ($e = array_pop($q))){$o .= '</'.$e.'>';}
@ -208,7 +217,8 @@ function hl_cmtcd($t){
if(substr(($t = preg_replace('`--+`', '-', substr($t, 4, -3))), -1) != ' '){$t .= ' ';}
$t = $C['comment'] == 2 ? str_replace(array('&', '<', '>'), array('&amp;', '&lt;', '&gt;'), $t) : $t;
$t = "\x01\x02\x04!--$t--\x05\x02\x01";
}else{ // CDATA
}
else { // CDATA
if(!$C['cdata']){return $t;}
if($C['cdata'] == 1){return '';}
$t = substr($t, 1, -1);
@ -383,7 +393,8 @@ $t = str_replace(array("\t", "\r", "\n", ' '), '', preg_replace('/"(?>(`.|[^"])*
break; case 1:
if($a[0] == '='){ // =
$w = 1; $mode = 2; $a = ltrim($a, '= ');
}else{ // No val
}
else { // No val
$w = 1; $mode = 0; $a = ltrim($a);
$aA[$nm] = '';
}
@ -432,7 +443,10 @@ $t = str_replace(array("\t", "\r", "\n", ' '), '', preg_replace('/"(?>(`.|[^"])*
if(!preg_match('`\bnofollow\b`i', $a['rel'])){$a['rel'] .= ' nofollow';}
}elseif(isset($aA['rel'])){
if(!preg_match('`\bnofollow\b`i', $aA['rel'])){$nfr = 1;}
}else{$a['rel'] = 'nofollow';}
}
else{
$a['rel'] = 'nofollow';
}
}
}
}
@ -506,7 +520,8 @@ $t = str_replace(array("\t", "\r", "\n", ' '), '', preg_replace('/"(?>(`.|[^"])*
// unique ID
if($C['unique_ids'] && isset($a['id'])){
if(!preg_match('`^[A-Za-z][A-Za-z0-9_\-.:]*$`', ($id = $a['id'])) or (isset($GLOBALS['hl_Ids'][$id]) && $C['unique_ids'] == 1)){unset($a['id']);
}else{
}
else {
while(isset($GLOBALS['hl_Ids'][$id])){$id = $C['unique_ids']. $id;}
$GLOBALS['hl_Ids'][($a['id'] = $id)] = 1;
}
@ -591,7 +606,9 @@ $t = str_replace(array("\t", "\r", "\n", ' '), '', preg_replace('/"(?>(`.|[^"])*
}elseif(isset($b[$y])){$o .= $f.$e.$r;
}elseif(isset($a[$y])){$o .= $e.$f.ltrim($r);
}elseif(!$y){$o .= $f.$e.$f.ltrim($r);
}else{$o .= $e.$r;}
}
else {
$o .= $e.$r;}
}
$t = preg_replace('`[\n]\s*?[\n]+`', "\n", $o);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -398,64 +398,115 @@ function agent_changed_by_multiple_agents_id (event, id_agent, selected) {
* @param id_agent_module_selector id of the selector for the modules of the agent.
*/
function agent_module_autocomplete (id_agent_name, id_agent_id, id_agent_module_selector, id_server_name, noneValue) {
$(id_agent_name).autocomplete(
"ajax.php",
{
minChars: 2,
scroll:true,
extraParams: {
page: "include/ajax/agent",
search_agents: 1
},
formatItem: function (data, i, total) {
if (total == 0)
$(id_agent_name).css ('background-color', '#cc0000');
else
$(id_agent_name).css ('background-color', '');
if (data == "")
return false;
return data[0]+'<br><span class="ac_extra_field"><?php echo __("IP") ?>: '+data[2]+'</span>';
},
delay: 200
}
);
// Callback from the autocomplete
$(id_agent_name).result (
function (e, data, formatted) {
$(id_agent_module_selector).attr('disabled', false);
agent_id = data[1];
server_name = data[2];
$(id_server_name).val(server_name);
//Check exist the field with id in the var id_agent_name.
if ($(id_agent_name).length == 0)
return;
$(id_agent_name).autocomplete({
minLength: 2,
source: function( request, response ) {
var term = request.term; //Word to search
var data_params = {"page": "include/ajax/agent",
"search_agents_2": 1,
"q": term};
jQuery.ajax ({
data: data_params,
async: false,
type: 'POST',
url: action="ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
response(data);
return;
}
});
return;
},
select: function( event, ui ) {
var agent_name = ui.item.name;
var agent_id = ui.item.id;
var server_name = ui.item.ip;
//Put the name
$(this).val(agent_name);
//Put the id
if (typeof(id_agent_id) != "undefined") {
$(id_agent_id).val(agent_id);
jQuery.post ('ajax.php',
{"page": "operation/agentes/ver_agente",
"get_agent_modules_json": 1,
"id_agent": agent_id,
"server_name": server_name,
"filter" : 'disabled=0 AND delete_pending=0',
"fields" : "id_agente_modulo,nombre"
},
function (data) {
$(id_agent_module_selector).empty();
if (typeof(noneValue) != "undefined") {
if (noneValue == true) {
option = $("<option></option>")
.attr ("value", 0)
.html ("--");
$(id_agent_module_selector).append (option);
}
}
jQuery.each (data, function (i, value) {
option = $("<option></option>")
.attr ("value", value['id_agente_modulo'])
.html (js_html_entity_decode (value['nombre']));
$(id_agent_module_selector).append (option);
});
},
"json"
);
}
);
//Put the server
if (typeof(id_server_name) != "undefined") {
$(id_server_name).val(server_name);
}
//Fill the modules select box
$(id_agent_module_selector).fadeOut ('normal', function () {
$('#module').empty ();
var data_params = {"page": "operation/agentes/ver_agente",
"get_agent_modules_json": 1,
"id_agent": agent_id,
"server_name": server_name,
"filter" : 'disabled=0 AND delete_pending=0',
"fields" : "id_agente_modulo,nombre"};
jQuery.ajax ({
data: data_params,
type: 'POST',
url: action="ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
$(id_agent_module_selector).empty();
if (typeof(noneValue) != "undefined") {
if (noneValue == true) {
option = $("<option></option>")
.attr ("value", 0)
.html ("--");
$(id_agent_module_selector).append (option);
}
}
jQuery.each (data, function (i, value) {
option = $("<option></option>")
.attr ("value", value['id_agente_modulo'])
.html (js_html_entity_decode (value['nombre']));
$(id_agent_module_selector).append (option);
});
$(id_agent_module_selector).fadeIn ('normal');
}
});
});
return false;
}
})
.data( "autocomplete")._renderItem = function( ul, item ) {
if (item.ip == '') {
text = "<a>" + item.name + "</a>";
}
else {
text = "<a>" + item.name
+ "<br><span style='font-size: 70%; font-style: italic;'>IP:" + item.ip + "</span></a>";
}
return $("<li></li>")
.data("item.autocomplete", item)
.append(text)
.appendTo(ul);
};
//Force the size of autocomplete
$(".ui-autocomplete").css("max-height", "100px");
$(".ui-autocomplete").css("overflow-y", "auto");
/* prevent horizontal scrollbar */
$(".ui-autocomplete").css("overflow-x", "hidden");
/* add padding to account for vertical scrollbar */
$(".ui-autocomplete").css("padding-right", "20px");
//Force to style of items
$(".ui-autocomplete").css("text-align", "left");
}
/**
@ -470,36 +521,77 @@ function agent_module_autocomplete (id_agent_name, id_agent_id, id_agent_module_
* @param id_agent_module_selector id of the selector for the modules of the agent.
*/
function agent_autocomplete (id_agent_name, id_server_name, id_agent_id ) {
$(id_agent_name).autocomplete(
"ajax.php",
{
minChars: 2,
scroll:true,
extraParams: {
page: "include/ajax/agent",
search_agents: 1
},
formatItem: function (data, i, total) {
if (total == 0)
$(id_agent_name).css ('background-color', '#cc0000');
else
$(id_agent_name).css ('background-color', '');
if (data == "")
return false;
return data[0]+'<br><span class="ac_extra_field"><?php echo __("IP") ?>: '+data[2]+'</span>';
},
delay: 200
}
);
// Callback from the autocomplete
$(id_agent_name).result (
function (e, data, formatted) {
//$(id_agent_module_selector).attr('disabled', false);
agent_id = data[1];
server_name = data[2];
$(id_server_name).val(server_name);
//Check exist the field with id in the var id_agent_name.
if ($(id_agent_name).length == 0)
return;
$(id_agent_name).autocomplete({
minLength: 2,
source: function( request, response ) {
var term = request.term; //Word to search
var data_params = {"page": "include/ajax/agent",
"search_agents_2": 1,
"q": term};
jQuery.ajax ({
data: data_params,
async: false,
type: 'POST',
url: action="ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
response(data);
return;
}
});
return;
},
select: function( event, ui ) {
var agent_id = ui.item.id;
var server_name = ui.item.ip;
var agent_name = ui.item.name;
//Put the name
$(this).val(agent_name);
//Put the id
if (typeof(id_agent_id) != "undefined") {
$(id_agent_id).val(agent_id);
}
);
//Put the server
if (typeof(id_server_name) != "undefined") {
$(id_server_name).val(server_name);
}
return false;
}
})
.data( "autocomplete")._renderItem = function( ul, item ) {
if (item.ip == '') {
text = "<a>" + item.name + "</a>";
}
else {
text = "<a>" + item.name
+ "<br><span style='font-size: 70%; font-style: italic;'>IP:" + item.ip + "</span></a>";
}
return $("<li></li>")
.data("item.autocomplete", item)
.append(text)
.appendTo(ul);
};
//Force the size of autocomplete
$(".ui-autocomplete").css("max-height", "100px");
$(".ui-autocomplete").css("overflow-y", "auto");
/* prevent horizontal scrollbar */
$(".ui-autocomplete").css("overflow-x", "hidden");
/* add padding to account for vertical scrollbar */
$(".ui-autocomplete").css("padding-right", "20px");
//Force to style of items
$(".ui-autocomplete").css("text-align", "left");
}

View File

@ -14,8 +14,17 @@
- node_begin Id of the beginning node
- node_end Id of the finishing node
* @param id_div Div to draw the lines in
* @param editor Boolean variable to set other css selector in editor (when true).
*/
function draw_line (line, id_div) {
function draw_line (line, id_div, editor) {
if (typeof(editor) == 'undefined') {
editor = false;
selector = 'margin-';
}
if (editor) {
selector = '';
}
div = document.getElementById (id_div);
brush = new jsGraphics (div);
brush.setStroke (1);
@ -23,23 +32,27 @@ function draw_line (line, id_div) {
if (line['x1']) {
x1 = line['x'];
} else {
x1 = parseInt ($('#'+line['node_begin']).css ('margin-left')) + ($('#'+line['node_begin']).width() / 2);
}
else {
x1 = parseInt ($('#'+line['node_begin']).css (selector + 'left')) + ($('#'+line['node_begin']).width() / 2);
}
if (line['y1']) {
y1 = line['y1'];
} else {
y1 = parseInt ($('#'+line['node_begin']).css ('margin-top')) + ($('#'+line['node_begin']).height() / 2);
}
else {
y1 = parseInt ($('#'+line['node_begin']).css (selector + 'top')) + ($('#'+line['node_begin']).height() / 2);
}
if (line['x2']) {
x2 = line['x2'];
} else {
x2 = parseInt ($('#'+line['node_end']).css ('margin-left')) + ($('#'+line['node_end']).width() / 2);
}
else {
x2 = parseInt ($('#'+line['node_end']).css (selector + 'left')) + ($('#'+line['node_end']).width() / 2);
}
if (line['y2']) {
y2 = line['y2'];
} else {
y2 = parseInt ($('#'+line['node_end']).css ('margin-top')) + ($('#'+line['node_end']).height() / 2);
}
else {
y2 = parseInt ($('#'+line['node_end']).css (selector + 'top')) + ($('#'+line['node_end']).height() / 2);
}
brush.drawLine (x1, y1, x2, y2);
brush.paint ();
@ -50,10 +63,11 @@ function draw_line (line, id_div) {
*
* @param lines Array with lines objects (see draw_line)
* @param id_div Div to draw the lines in
* @param editor Boolean variable to set other css selector in editor (when true).
*/
function draw_lines (lines, id_div) {
function draw_lines (lines, id_div, editor) {
jQuery.each (lines, function () {
draw_line (this, id_div);
draw_line (this, id_div, editor);
});
}
@ -77,8 +91,9 @@ function delete_lines (id_div) {
*
* @param lines Array with lines objects (see draw_line)
* @param id_div Div to draw the lines in
* @param editor Boolean variable to set other css selector in editor (when true).
*/
function refresh_lines (lines, id_div) {
function refresh_lines (lines, id_div, editor) {
delete_lines (id_div);
draw_lines (lines, id_div);
draw_lines (lines, id_div, editor);
}

View File

@ -229,12 +229,13 @@ class PchartGraph extends PandoraGraphAbstract {
$this->xaxis_interval = ($this->xaxis_interval / 7 >= 1) ? ($this->xaxis_interval / 7) : 10;
// Remove axis values if graph is small
if ($this->width > MIN_WIDTH && $this->height > MIN_HEIGHT){
if ($this->width > MIN_WIDTH && $this->height > MIN_HEIGHT) {
$this->graph->drawScale ($this->dataset->GetData (),
$this->dataset->GetDataDescription (), SCALE_START0,
80, 80, 80, $this->show_axis, 0, 50, false,
$this->xaxis_interval);
}else{
}
else {
$this->graph->drawScale ($this->dataset->GetData (),
$this->dataset->GetDataDescription (), SCALE_START0,
80, 80, 80, false, 0, 50, false,

View File

@ -0,0 +1,572 @@
/*
* jQuery UI CSS Framework 1.8.17
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Theming/API
*/
/* Layout helpers
----------------------------------*/
.ui-helper-hidden { display: none; }
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
.ui-helper-clearfix:after { clear: both; }
.ui-helper-clearfix { zoom: 1; }
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
/* Interaction Cues
----------------------------------*/
.ui-state-disabled { cursor: default !important; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
/* Misc visuals
----------------------------------*/
/* Overlays */
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/*
* jQuery UI CSS Framework 1.8.17
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Theming/API
*
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
*/
/* Component containers
----------------------------------*/
.ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; }
.ui-widget .ui-widget { font-size: 1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; }
.ui-widget-content { border: 1px solid #dddddd; background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; }
.ui-widget-content a { color: #333333; }
.ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
.ui-widget-header a { color: #ffffff; }
/* Interaction states
----------------------------------*/
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; }
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
.ui-state-hover, .ui-widget-content .ui-state-hover,
.ui-widget-header .ui-state-hover, .ui-state-focus,
.ui-widget-content .ui-state-focus,
.ui-widget-header .ui-state-focus {
border: 1px solid #fbcb09;
/*background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x;*/
background: #fdf5ce 50% 50% repeat-x;
font-weight: bold; color: #c77405; }
.ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; }
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; text-decoration: none; }
.ui-widget :active { outline: none; }
/* Interaction Cues
----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; }
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; }
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; }
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; }
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }
.ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); }
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); }
/* positioning */
.ui-icon-carat-1-n { background-position: 0 0; }
.ui-icon-carat-1-ne { background-position: -16px 0; }
.ui-icon-carat-1-e { background-position: -32px 0; }
.ui-icon-carat-1-se { background-position: -48px 0; }
.ui-icon-carat-1-s { background-position: -64px 0; }
.ui-icon-carat-1-sw { background-position: -80px 0; }
.ui-icon-carat-1-w { background-position: -96px 0; }
.ui-icon-carat-1-nw { background-position: -112px 0; }
.ui-icon-carat-2-n-s { background-position: -128px 0; }
.ui-icon-carat-2-e-w { background-position: -144px 0; }
.ui-icon-triangle-1-n { background-position: 0 -16px; }
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
.ui-icon-triangle-1-e { background-position: -32px -16px; }
.ui-icon-triangle-1-se { background-position: -48px -16px; }
.ui-icon-triangle-1-s { background-position: -64px -16px; }
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
.ui-icon-triangle-1-w { background-position: -96px -16px; }
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
.ui-icon-arrow-1-n { background-position: 0 -32px; }
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
.ui-icon-arrow-1-e { background-position: -32px -32px; }
.ui-icon-arrow-1-se { background-position: -48px -32px; }
.ui-icon-arrow-1-s { background-position: -64px -32px; }
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
.ui-icon-arrow-1-w { background-position: -96px -32px; }
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
.ui-icon-arrow-4 { background-position: 0 -80px; }
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
.ui-icon-extlink { background-position: -32px -80px; }
.ui-icon-newwin { background-position: -48px -80px; }
.ui-icon-refresh { background-position: -64px -80px; }
.ui-icon-shuffle { background-position: -80px -80px; }
.ui-icon-transfer-e-w { background-position: -96px -80px; }
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
.ui-icon-folder-collapsed { background-position: 0 -96px; }
.ui-icon-folder-open { background-position: -16px -96px; }
.ui-icon-document { background-position: -32px -96px; }
.ui-icon-document-b { background-position: -48px -96px; }
.ui-icon-note { background-position: -64px -96px; }
.ui-icon-mail-closed { background-position: -80px -96px; }
.ui-icon-mail-open { background-position: -96px -96px; }
.ui-icon-suitcase { background-position: -112px -96px; }
.ui-icon-comment { background-position: -128px -96px; }
.ui-icon-person { background-position: -144px -96px; }
.ui-icon-print { background-position: -160px -96px; }
.ui-icon-trash { background-position: -176px -96px; }
.ui-icon-locked { background-position: -192px -96px; }
.ui-icon-unlocked { background-position: -208px -96px; }
.ui-icon-bookmark { background-position: -224px -96px; }
.ui-icon-tag { background-position: -240px -96px; }
.ui-icon-home { background-position: 0 -112px; }
.ui-icon-flag { background-position: -16px -112px; }
.ui-icon-calendar { background-position: -32px -112px; }
.ui-icon-cart { background-position: -48px -112px; }
.ui-icon-pencil { background-position: -64px -112px; }
.ui-icon-clock { background-position: -80px -112px; }
.ui-icon-disk { background-position: -96px -112px; }
.ui-icon-calculator { background-position: -112px -112px; }
.ui-icon-zoomin { background-position: -128px -112px; }
.ui-icon-zoomout { background-position: -144px -112px; }
.ui-icon-search { background-position: -160px -112px; }
.ui-icon-wrench { background-position: -176px -112px; }
.ui-icon-gear { background-position: -192px -112px; }
.ui-icon-heart { background-position: -208px -112px; }
.ui-icon-star { background-position: -224px -112px; }
.ui-icon-link { background-position: -240px -112px; }
.ui-icon-cancel { background-position: 0 -128px; }
.ui-icon-plus { background-position: -16px -128px; }
.ui-icon-plusthick { background-position: -32px -128px; }
.ui-icon-minus { background-position: -48px -128px; }
.ui-icon-minusthick { background-position: -64px -128px; }
.ui-icon-close { background-position: -80px -128px; }
.ui-icon-closethick { background-position: -96px -128px; }
.ui-icon-key { background-position: -112px -128px; }
.ui-icon-lightbulb { background-position: -128px -128px; }
.ui-icon-scissors { background-position: -144px -128px; }
.ui-icon-clipboard { background-position: -160px -128px; }
.ui-icon-copy { background-position: -176px -128px; }
.ui-icon-contact { background-position: -192px -128px; }
.ui-icon-image { background-position: -208px -128px; }
.ui-icon-video { background-position: -224px -128px; }
.ui-icon-script { background-position: -240px -128px; }
.ui-icon-alert { background-position: 0 -144px; }
.ui-icon-info { background-position: -16px -144px; }
.ui-icon-notice { background-position: -32px -144px; }
.ui-icon-help { background-position: -48px -144px; }
.ui-icon-check { background-position: -64px -144px; }
.ui-icon-bullet { background-position: -80px -144px; }
.ui-icon-radio-off { background-position: -96px -144px; }
.ui-icon-radio-on { background-position: -112px -144px; }
.ui-icon-pin-w { background-position: -128px -144px; }
.ui-icon-pin-s { background-position: -144px -144px; }
.ui-icon-play { background-position: 0 -160px; }
.ui-icon-pause { background-position: -16px -160px; }
.ui-icon-seek-next { background-position: -32px -160px; }
.ui-icon-seek-prev { background-position: -48px -160px; }
.ui-icon-seek-end { background-position: -64px -160px; }
.ui-icon-seek-start { background-position: -80px -160px; }
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
.ui-icon-seek-first { background-position: -80px -160px; }
.ui-icon-stop { background-position: -96px -160px; }
.ui-icon-eject { background-position: -112px -160px; }
.ui-icon-volume-off { background-position: -128px -160px; }
.ui-icon-volume-on { background-position: -144px -160px; }
.ui-icon-power { background-position: 0 -176px; }
.ui-icon-signal-diag { background-position: -16px -176px; }
.ui-icon-signal { background-position: -32px -176px; }
.ui-icon-battery-0 { background-position: -48px -176px; }
.ui-icon-battery-1 { background-position: -64px -176px; }
.ui-icon-battery-2 { background-position: -80px -176px; }
.ui-icon-battery-3 { background-position: -96px -176px; }
.ui-icon-circle-plus { background-position: 0 -192px; }
.ui-icon-circle-minus { background-position: -16px -192px; }
.ui-icon-circle-close { background-position: -32px -192px; }
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
.ui-icon-circle-zoomin { background-position: -176px -192px; }
.ui-icon-circle-zoomout { background-position: -192px -192px; }
.ui-icon-circle-check { background-position: -208px -192px; }
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
.ui-icon-circlesmall-close { background-position: -32px -208px; }
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
.ui-icon-squaresmall-close { background-position: -80px -208px; }
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
/* Misc visuals
----------------------------------*/
/* Corner radius */
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
/* Overlays */
.ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); }
.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -khtml-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/*
* jQuery UI Resizable 1.8.17
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Resizable#theming
*/
.ui-resizable { position: relative;}
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; }
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
* jQuery UI Selectable 1.8.17
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Selectable#theming
*/
.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
/*
* jQuery UI Accordion 1.8.17
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Accordion#theming
*/
/* IE/Win - Fix animation bug - #4615 */
.ui-accordion { width: 100%; }
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
.ui-accordion .ui-accordion-li-fix { display: inline; }
.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
.ui-accordion .ui-accordion-content-active { display: block; }
/*
* jQuery UI Autocomplete 1.8.17
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Autocomplete#theming
*/
.ui-autocomplete { position: absolute; cursor: default; }
/* workarounds */
* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
/*
* jQuery UI Menu 1.8.17
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Menu#theming
*/
.ui-menu {
list-style:none;
padding: 2px;
margin: 0;
display:block;
float: left;
}
.ui-menu .ui-menu {
margin-top: -3px;
}
.ui-menu .ui-menu-item {
margin:0;
padding: 0;
zoom: 1;
float: left;
clear: left;
width: 100%;
}
.ui-menu .ui-menu-item a {
text-decoration:none;
display:block;
padding:.2em .4em;
line-height:1.5;
zoom:1;
}
.ui-menu .ui-menu-item a.ui-state-hover,
.ui-menu .ui-menu-item a.ui-state-active {
font-weight: normal;
margin: -1px;
}
/*
* jQuery UI Button 1.8.17
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Button#theming
*/
.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
.ui-button-icons-only { width: 3.4em; }
button.ui-button-icons-only { width: 3.7em; }
/*button text element */
.ui-button .ui-button-text { display: block; line-height: 1.4; }
.ui-button-text-only .ui-button-text { padding: .4em 1em; }
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
/* no icon support for input elements, provide padding by default */
input.ui-button { padding: .4em 1em; }
/*button icon element(s) */
.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
/*button sets*/
.ui-buttonset { margin-right: 7px; }
.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
/* workarounds */
button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
/*
* jQuery UI Dialog 1.8.17
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Dialog#theming
*/
.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
.ui-draggable .ui-dialog-titlebar { cursor: move; }
/*
* jQuery UI Slider 1.8.17
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Slider#theming
*/
.ui-slider { position: relative; text-align: left; }
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
.ui-slider-horizontal { height: .8em; }
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
.ui-slider-vertical { width: .8em; height: 100px; }
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
.ui-slider-vertical .ui-slider-range-max { top: 0; }/*
* jQuery UI Tabs 1.8.17
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Tabs#theming
*/
.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
.ui-tabs .ui-tabs-hide { display: none !important; }
/*
* jQuery UI Datepicker 1.8.17
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Datepicker#theming
*/
.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
.ui-datepicker .ui-datepicker-prev { left:2px; }
.ui-datepicker .ui-datepicker-next { right:2px; }
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
.ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year { width: 49%;}
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
.ui-datepicker td { border: 0; padding: 1px; }
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
/* with multiple calendars */
.ui-datepicker.ui-datepicker-multi { width:auto; }
.ui-datepicker-multi .ui-datepicker-group { float:left; }
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
/* RTL support */
.ui-datepicker-rtl { direction: rtl; }
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
.ui-datepicker-cover {
display: none; /*sorry for IE5*/
display/**/: block; /*sorry for IE5*/
position: absolute; /*must have*/
z-index: -1; /*must have*/
filter: mask(); /*must have*/
top: -4px; /*must have*/
left: -4px; /*must have*/
width: 200px; /*must have*/
height: 200px; /*must have*/
}/*
* jQuery UI Progressbar 1.8.17
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Progressbar#theming
*/
.ui-progressbar { height:2em; text-align: left; overflow: hidden; }
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }

View File

@ -303,7 +303,7 @@ 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.binary_min,
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;
}
@ -373,6 +373,12 @@ input.percentile_min {
input.percentile_min[disabled] {
background: #e5e5e5 url(../../images/chart_bar.disabled.png) no-repeat center;
}
input.percentile_item_min {
background: #e5e5e5 url(../../images/percentile_item.png) no-repeat center;
}
input.percentile_item_min[disabled] {
background: #e5e5e5 url(../../images/percentile_item.disabled.png) no-repeat center;
}
input.binary_min {
background: #e5e5e5 url(../../images/binary.png) no-repeat center;
}

View File

@ -17,6 +17,7 @@ global $config;
if (is_ajax ()) {
$search_agents = (bool) get_parameter ('search_agents');
$search_agents_2 = (bool) get_parameter ('search_agents_2');
if ($search_agents) {
@ -68,6 +69,59 @@ if (is_ajax ()) {
return;
}
if ($search_agents_2) {
require_once ('include/functions_agents.php');
$id_agent = (int) get_parameter ('id_agent');
$string = (string) get_parameter ('q'); /* q is what autocomplete plugin gives */
$id_group = (int) get_parameter('id_group', -1);
$addedItems = html_entity_decode((string) get_parameter('add'));
$addedItems = json_decode($addedItems);
$all = (string)get_parameter('all', 'all');
if ($addedItems != null) {
foreach ($addedItems as $item) {
echo $item . "|\n";
}
}
$filter = array ();
switch ($config['dbtype']) {
case "mysql":
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
break;
case "postgresql":
$filter[] = '(nombre LIKE \'%'.$string.'%\' OR direccion LIKE \'%'.$string.'%\' OR comentarios LIKE \'%'.$string.'%\')';
break;
case "oracle":
$filter[] = '(UPPER(nombre) LIKE UPPER(\'%'.$string.'%\') OR UPPER(direccion) LIKE UPPER(\'%'.$string.'%\') OR UPPER(comentarios) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
if ($id_group != -1)
$filter['id_grupo'] = $id_group;
switch ($all) {
case 'enabled':
$filter['disabled'] = 0;
break;
}
$agents = agents_get_agents ($filter, array ('id_agente', 'nombre', 'direccion'));
if ($agents === false)
$agents = array();
$data = array();
foreach ($agents as $agent) {
$data[] = array('id' => $agent['id_agente'], 'name' => io_safe_output($agent['nombre']), 'ip' => io_safe_output($agent['direccion']));
}
echo json_encode($data);
return;
}
return;
}
@ -226,13 +280,13 @@ if (!empty ($export_btn) && !empty ($module)) {
$arr["agent_id"] = modules_get_agentmodule_agent ($selected);
$arr["utimestamp"] = $end;
array_push ($data, $arr);
} else {
}
else {
$data_single = modules_get_agentmodule_data ($selected, $work_period, $work_end);
if (!empty ($data_single)) {
$data = array_merge ($data, $data_single);
}
}
/*
if ($work_end > $end) {
$work_period = $work_end - $end;
@ -250,7 +304,7 @@ if (!empty ($export_btn) && !empty ($module)) {
$output .= date ("Y-m-d G:i:s", $module['utimestamp']);
$output .= $rowend;
}
switch ($export_type) {
default:
case "data":
@ -268,28 +322,30 @@ if (!empty ($export_btn) && !empty ($module)) {
unset($data_single);
$work_end = $work_end + $work_period;
}
unset ($output);
$output = "";
unset ($output);
$output = "";
} // main foreach
echo $dataend;
break;
default:
ui_print_error_message (__('Invalid method supplied'));
return;
break;
break;
}
switch ($export_type) {
case "excel":
case "csv":
exit; // Necesary for CSV export, if not give problems
break;
default:
return;
case "excel":
case "csv":
exit; // Necesary for CSV export, if not give problems
break;
default:
return;
break;
}
} elseif (!empty ($export_btn) && empty ($module)) {
}
elseif (!empty ($export_btn) && empty ($module)) {
ui_print_error_message (__('No modules specified'));
}
@ -388,13 +444,12 @@ echo '</div></form>';
ui_require_jquery_file ('pandora.controls');
ui_require_jquery_file ('ajaxqueue');
ui_require_jquery_file ('bgiframe');
ui_require_jquery_file ('autocomplete');
?>
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready (function () {
var inputActive = true;
$.ajax({
type: "POST",
url: "ajax.php",
@ -411,34 +466,68 @@ $(document).ready (function () {
});
if (inputActive) {
$("#text-agent").autocomplete(
"ajax.php",
{
minChars: 2,
scroll:true,
extraParams: {
$("#text-agent").autocomplete({
minLength: 2,
source: function( request, response ) {
var term = request.term; //Word to search
var data_params = {
page: "operation/agentes/exportdata",
search_agents: 1,
id_group: function() { return $("#group").val(); }
},
formatItem: function (data, i, total) {
if (total == 0)
$("#text-agent").css ('background-color', '#cc0000');
else
$("#text-agent").css ('background-color', '');
if (data == "")
return false;
return data[0]+'<br><span class="ac_extra_field"><?php echo __("IP") ?>: '+data[1]+'</span>';
},
delay: 200
search_agents_2: 1,
id_group: function() { return $("#group").val(); },
"q": term};
jQuery.ajax ({
data: data_params,
async: false,
type: "POST",
url: action="ajax.php",
timeout: 10000,
dataType: "json",
success: function (data) {
response(data);
return;
}
});
return;
},
select: function( event, ui ) {
var agent_name = ui.item.name;
//Put the name
$(this).val(agent_name);
this.form.submit();
return false;
}
);
})
.data( "autocomplete")._renderItem = function( ul, item ) {
if ((item.ip == "") || (typeof(item.ip) == "undefined")) {
text = "<a>" + item.name + "</a>";
}
else {
text = "<a>" + item.name
+ "<br><span style=\"font-size: 70%; font-style: italic;\">IP:" + item.ip + "</span></a>";
}
return $("<li></li>")
.data("item.autocomplete", item)
.append(text)
.appendTo(ul);
};
//Force the size of autocomplete
$(".ui-autocomplete").css("max-height", "100px");
$(".ui-autocomplete").css("overflow-y", "auto");
/* prevent horizontal scrollbar */
$(".ui-autocomplete").css("overflow-x", "hidden");
/* add padding to account for vertical scrollbar */
$(".ui-autocomplete").css("padding-right", "20px");
//Force to style of items
$(".ui-autocomplete").css("text-align", "left");
}
$("#text-agent").result(function(event, data, formatted) {
this.form.submit();
});
});
/* ]]> */
</script>

View File

@ -366,39 +366,69 @@ else {
}
ui_require_jquery_file ('bgiframe');
ui_require_jquery_file ('autocomplete');
?>
<script language="javascript" type="text/javascript">
/* <![CDATA[ */
$(document).ready( function() {
$("#text_id_agent").autocomplete(
"ajax.php",
{
minChars: 2,
scroll:true,
extraParams: {
page: "operation/agentes/exportdata",
search_agents: 1,
add: '<?php echo json_encode(array('-1' => "All", '0' => "System"));?>',
id_group: function() { return $("#id_group").val(); }
},
formatItem: function (data, i, total) {
if (total == 0)
$("#text_id_agent").css ('background-color', '#cc0000');
else
$("#text_id_agent").css ('background-color', '');
if (data == "")
return false;
return data[0]+'<br><span class="ac_extra_field"><?php echo __("IP") ?>: '+data[1]+'</span>';
},
delay: 200
}
);
$("#text_id_agent").autocomplete({
minLength: 2,
source: function( request, response ) {
var term = request.term; //Word to search
var data_params = {
"page": "godmode/agentes/agent_manager",
"search_parents_2": 1,
"q": term};
jQuery.ajax ({
data: data_params,
async: false,
type: "POST",
url: action="ajax.php",
timeout: 10000,
dataType: "json",
success: function (data) {
response(data);
return;
}
});
return;
},
select: function( event, ui ) {
var agent_name = ui.item.name;
//Put the name
$(this).val(agent_name);
return false;
}
})
.data( "autocomplete")._renderItem = function( ul, item ) {
if (item.ip == "") {
text = "<a>" + item.name + "</a>";
}
else {
text = "<a>" + item.name
+ "<br><span style=\"font-size: 70%; font-style: italic;\">IP:" + item.ip + "</span></a>";
}
return $("<li></li>")
.data("item.autocomplete", item)
.append(text)
.appendTo(ul);
};
//Force the size of autocomplete
$(".ui-autocomplete").css("max-height", "100px");
$(".ui-autocomplete").css("overflow-y", "auto");
/* prevent horizontal scrollbar */
$(".ui-autocomplete").css("overflow-x", "hidden");
/* add padding to account for vertical scrollbar */
$(".ui-autocomplete").css("padding-right", "20px");
//Force to style of items
$(".ui-autocomplete").css("text-align", "left");
$("input[name=allbox]").change (function() {
$("input[name='eventid[]']").attr('checked', $(this).attr('checked'));

View File

@ -36,14 +36,14 @@ if (! check_acl ($config["id_user"], 0, "IR")) {
return;
}
if (is_ajax()){
if (is_ajax()) {
$get_filter_values = get_parameter('get_filter_values', 0);
$save_event_filter = get_parameter('save_event_filter', 0);
$update_event_filter = get_parameter('update_event_filter', 0);
$get_event_filters = get_parameter('get_event_filters', 0);
// Get db values of a single filter
if ($get_filter_values){
if ($get_filter_values) {
$id_filter = get_parameter('id');
$event_filter = events_get_event_filter($id_filter);
@ -55,7 +55,7 @@ if (is_ajax()){
}
// Saves an event filter
if ($save_event_filter){
if ($save_event_filter) {
$values = array();
$values['id_name'] = get_parameter('id_name');
$values['id_group'] = get_parameter('id_group');
@ -668,22 +668,22 @@ foreach ($result as $event) {
}
switch ($event["criticity"]) {
default:
case 0:
$img_sev = "images/status_sets/default/severity_maintenance.png";
break;
case 1:
$img_sev = "images/status_sets/default/severity_informational.png";
break;
case 2:
$img_sev = "images/status_sets/default/severity_normal.png";
break;
case 3:
$img_sev = "images/status_sets/default/severity_warning.png";
break;
case 4:
$img_sev = "images/status_sets/default/severity_critical.png";
break;
default:
case 0:
$img_sev = "images/status_sets/default/severity_maintenance.png";
break;
case 1:
$img_sev = "images/status_sets/default/severity_informational.png";
break;
case 2:
$img_sev = "images/status_sets/default/severity_normal.png";
break;
case 3:
$img_sev = "images/status_sets/default/severity_warning.png";
break;
case 4:
$img_sev = "images/status_sets/default/severity_critical.png";
break;
}
if (in_array('evento', $show_fields)) {
@ -760,7 +760,8 @@ foreach ($result as $event) {
$templateName = db_get_sql($sql);
$data[$i] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$event["id_agente"].'&amp;tab=alert">'.$templateName.'</a>';
} else {
}
else {
$data[$i] = '';
}
$i++;
@ -791,7 +792,8 @@ foreach ($result as $event) {
$data[$i] .= ',';
}
$data[$i] = rtrim($data[$i], ',');
} else {
}
else {
$data[$i] = '';
}
$i++;
@ -1053,7 +1055,8 @@ foreach ($result as $event) {
}
$string = rtrim($string, ',');
$odd = ($odd == '')? 'rowOdd' : '';
} else {
}
else {
$string .= '<i>- ' . __('Empty') . ' -</i>';
$odd = ($odd == '')? 'rowOdd' : '';
}
@ -1184,7 +1187,7 @@ $(document).ready( function() {
"id" : $('#filter_id').val()
},
function (data) {
jQuery.each (data, function (i, val) {
jQuery.each (data, function (i, val) {
if (i == 'id_name')
$("#text-id_name").val(val);
if (i == 'id_group')
@ -1206,13 +1209,13 @@ $(document).ready( function() {
if (i == 'id_user_ack')
$("#id_user_ack").val(val);
if (i == 'group_rep')
$("#group_rep").val(val);
$("#group_rep").val(val);
if (i == 'tag')
$("#tag").val(val);
if (i == 'filter_only_alert')
$("#filter_only_alert").val(val);
if (i == 'id_group_filter')
$("#id_group").val(val);
$("#id_group").val(val);
});
},
"json"
@ -1221,7 +1224,7 @@ $(document).ready( function() {
});
// This saves an event filter
$("#submit-save_filter").click(function () {
$("#submit-save_filter").click(function () {
// Checks if the filter has name or not
if ($('#row_name').css('visibility') == 'hidden') {
$('#row_name').css('visibility', '');
@ -1229,9 +1232,10 @@ $(document).ready( function() {
$('#filter_name_color').css('color', '#CC0000');
$('#filter_group_color').css('color', '#CC0000');
// If the filter has name insert in database
}else{
}
else {
$('#filter_name_color').css('color', '#000000');
$('#filter_group_color').css('color', '#000000');
$('#filter_group_color').css('color', '#000000');
// If the filter name is blank show error
if ($('#text-id_name').val() == '') {
$('#show_filter_error').html('<h3 class="error"> <?php echo __('Filter name cannot be left blank'); ?> </h3>');
@ -1259,9 +1263,10 @@ $(document).ready( function() {
"id_group_filter": $("#id_group").val()
},
function (data) {
if (data == 'error'){
if (data == 'error') {
$('#show_filter_error').html('<h3 class="error"> <?php echo __('Error creating filter'); ?> </h3>');
}else{
}
else {
id_filter_save = data;
$('#show_filter_error').html('<h3 class="suc"> <?php echo __('Filter created'); ?> </h3>');
}
@ -1278,19 +1283,20 @@ $(document).ready( function() {
},
function (data) {
jQuery.each (data, function (i, val) {
s = js_html_entity_decode(val);
if (i == id_filter_save){
s = js_html_entity_decode(val);
if (i == id_filter_save){
$('#filter_id').append ($('<option selected="selected"></option>').html (s).attr ("value", i));
} else {
}
else {
$('#filter_id').append ($('<option></option>').html (s).attr ("value", i));
}
}
});
},
"json"
);
$("#submit-update_filter").css('visibility', '');
}
$("#submit-update_filter").css('visibility', '');
}
return false;
});
@ -1327,7 +1333,8 @@ $(document).ready( function() {
function (data) {
if (data == 'ok'){
$('#show_filter_error').html('<h3 class="suc"> <?php echo __('Filter updated'); ?> </h3>');
}else{
}
else {
$('#show_filter_error').html('<h3 class="error"> <?php echo __('Error updating filter'); ?> </h3>');
}
});
@ -1346,7 +1353,8 @@ $(document).ready( function() {
s = js_html_entity_decode(val);
if (i == id_filter_update){
$('#filter_id').append ($('<option selected="selected"></option>').html (s).attr ("value", i));
} else {
}
else {
$('#filter_id').append ($('<option></option>').html (s).attr ("value", i));
}
});
@ -1375,7 +1383,8 @@ $(document).ready( function() {
$("#toggle_arrow").attr('src', data);
}
});
}else{
}
else {
var params = [];
params.push("get_image_path=1");
params.push("img_src=images/go.png");

View File

@ -389,9 +389,10 @@ if ($draw != '') {
$(document).ready( function() {
// Hide update filter button
if ($("#filter_id").val() == 0){
if ($("#filter_id").val() == 0) {
$("#submit-update_button").css("visibility", "hidden");
}else{
}
else {
$("#submit-update_button").css("visibility", "");
}
@ -400,7 +401,8 @@ if ($draw != '') {
if ($("#text-name").val() == ""){
$('#filter_name_color').css('color', '#CC0000');
$('#filter_group_color').css('color', '#CC0000');
}else{
}
else {
$('#filter_name_color').css('color', '#000000');
$('#filter_group_color').css('color', '#000000');
}