2013-05-16 Miguel de Dios <miguel.dedios@artica.es>

* ajax.php: fixed PHP warning when the HTTP_REFERER not set.
	
	* godmode/agentes/module_manager_editor_prediction.php,
	include/functions_ui.php, operation/agentes/ver_agente.php,
	operation/agentes/stat_win.php: improved the source code style.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8137 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-05-16 08:23:51 +00:00
parent 5c808b7266
commit 84d628326f
6 changed files with 41 additions and 19 deletions

View File

@ -1,3 +1,11 @@
2013-05-16 Miguel de Dios <miguel.dedios@artica.es>
* ajax.php: fixed PHP warning when the HTTP_REFERER not set.
* godmode/agentes/module_manager_editor_prediction.php,
include/functions_ui.php, operation/agentes/ver_agente.php,
operation/agentes/stat_win.php: improved the source code style.
2013-05-14 Miguel de Dios <miguel.dedios@artica.es>
* godmode/alerts/alert_commands.php: fixed the ajax of

View File

@ -75,9 +75,11 @@ if (file_exists ('./include/languages/'.$user_language.'.mo')) {
$l10n->load_tables();
}
// Not cool way of know if we are executing from metaconsole or normal console
if (strpos($_SERVER['HTTP_REFERER'], ENTERPRISE_DIR . '/meta/') !== false)
define ('METACONSOLE', true);
if (isset($_SERVER['HTTP_REFERER'])) {
// Not cool way of know if we are executing from metaconsole or normal console
if (strpos($_SERVER['HTTP_REFERER'], ENTERPRISE_DIR . '/meta/') !== false)
define ('METACONSOLE', true);
}
session_write_close ();
if (file_exists ($page)) {

View File

@ -132,8 +132,11 @@ if($id_agente) {
$sql = "SELECT id_agente_modulo, nombre
FROM tagente_modulo
WHERE delete_pending = 0
AND history_data = 1 AND id_agente = " . $id_agente_clean . " AND id_agente_modulo <> " . $id_agente_modulo;
$data[1] .= html_print_select_from_sql($sql, 'prediction_module', $prediction_module, false, __('Select Module'), 0, true);
AND history_data = 1
AND id_agente = " . $id_agente_clean . "
AND id_agente_modulo <> " . $id_agente_modulo;
$data[1] .= html_print_select_from_sql($sql, 'prediction_module',
$prediction_module, false, __('Select Module'), 0, true);
}
else {
$data[1] .= '<select id="prediction_module" name="custom_integer_1" disabled="disabled"><option value="0">Select an Agent first</option></select>';
@ -191,9 +194,10 @@ unset ($table_advanced->data[3]);
?>
<script type="text/javascript">
$(document).ready(function() {
<?php
enterprise_hook('setup_services_synth', array($is_service, $is_synthetic, $is_synthetic_avg, $is_netflow, $ops));
?>
});
$(document).ready(function() {
<?php
enterprise_hook('setup_services_synth',
array($is_service, $is_synthetic, $is_synthetic_avg, $is_netflow, $ops));
?>
});
</script>

View File

@ -72,6 +72,7 @@ function ui_print_truncate_text($text, $numChars = GENERIC_SIZE_TEXT, $showTextI
}
}
if ($numChars == 0) {
if ($return == true) {
return $text;
@ -83,12 +84,15 @@ function ui_print_truncate_text($text, $numChars = GENERIC_SIZE_TEXT, $showTextI
$text = io_safe_output($text);
if (mb_strlen($text, "UTF-8") > ($numChars)) {
$half_length = intval(($numChars - 3) / 2); // '/2' because [...] is in the middle of the word.
// '/2' because [...] is in the middle of the word.
$half_length = intval(($numChars - 3) / 2);
// Depending on the strange behavior of mb_strimwidth() itself,
// the 3rd parameter is not to be $numChars but the length of original text (just means 'large enough').
// the 3rd parameter is not to be $numChars but the length of
// original text (just means 'large enough').
$truncateText2 = mb_strimwidth($text,
(mb_strlen($text, "UTF-8") - $half_length), mb_strlen($text, "UTF-8"), "", "UTF-8" );
(mb_strlen($text, "UTF-8") - $half_length),
mb_strlen($text, "UTF-8"), "", "UTF-8" );
$truncateText = mb_strimwidth($text, 0,
($numChars - $half_length), "", "UTF-8") . $suffix;
@ -100,10 +104,11 @@ function ui_print_truncate_text($text, $numChars = GENERIC_SIZE_TEXT, $showTextI
$truncateText = $truncateText;
}
else if ($style !== false) {
$truncateText = '<span style="' . $style . '" title="'.$text.'">'.$truncateText.'</span>';
$truncateText = '<span style="' . $style . '" title="' . $text . '">' .
$truncateText . '</span>';
}
else {
$truncateText = '<span title="'.$text.'">'.$truncateText.'</span>';
$truncateText = '<span title="' . $text . '">' . $truncateText . '</span>';
}
}
if ($showTextInAToopTip) {
@ -111,7 +116,7 @@ function ui_print_truncate_text($text, $numChars = GENERIC_SIZE_TEXT, $showTextI
}
else {
if ($style !== false) {
$truncateText = '<span style="' . $style . '">'.$truncateText.'</span>';
$truncateText = '<span style="' . $style . '">' . $truncateText . '</span>';
}
}
}

View File

@ -297,6 +297,7 @@ $label = base64_decode(get_parameter('label', ''));
$table->data[] = $data;
$table->rowclass[] = '';
switch ($graph_type) {
case 'boolean':
case 'sparse':

View File

@ -300,9 +300,11 @@ if (is_ajax ()) {
}
$result = array();
foreach($nameModules as $nameModule) {
foreach ($nameModules as $nameModule) {
if (empty($serialized))
$result[io_safe_output($nameModule['nombre'])] = ui_print_truncate_text(io_safe_output($nameModule['nombre']), 'module_medium', false, true);
$result[io_safe_output($nameModule['nombre'])] =
ui_print_truncate_text(
io_safe_output($nameModule['nombre']), 'module_medium', false, true);
else
$result[io_safe_output($nameModule['nombre']).'$*$'.implode('|', $idAgents)] = ui_print_truncate_text(io_safe_output($nameModule['nombre']), 'module_medium', false, true);
}