2009-03-04 Esteban Sanchez <estebans@artica.es>

* godmode/agentes/manage_config.php: Fixed a javascript error that
	doesn't allow to perform any operation.

	* godmode/alerts/configure_alert_action.php: Fixed javascript file
	inclusion.

	* godmode/reporting/map_builder.php: Fixed typo when updating a
	layout.

	* images/download.png: Added to repository.

	* include/functions_agents.php: Style correction.

	* include/functions_html.php: Added additional options to
	print_input_image().

	* include/functions_ui.php: Added format_filesize().



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1507 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
esanchezm 2009-03-04 15:59:00 +00:00
parent 64868f54be
commit 34a8473d81
8 changed files with 72 additions and 16 deletions

View File

@ -1,3 +1,23 @@
2009-03-04 Esteban Sanchez <estebans@artica.es>
* godmode/agentes/manage_config.php: Fixed a javascript error that
doesn't allow to perform any operation.
* godmode/alerts/configure_alert_action.php: Fixed javascript file
inclusion.
* godmode/reporting/map_builder.php: Fixed typo when updating a
layout.
* images/download.png: Added to repository.
* include/functions_agents.php: Style correction.
* include/functions_html.php: Added additional options to
print_input_image().
* include/functions_ui.php: Added format_filesize().
2009-03-04 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/functions_reporting.php,

View File

@ -294,7 +294,7 @@ $(document).ready (function () {
return false;
}
if ($(copy_modules).attr ("checked") && $("#target_modules\\[\\]").fieldValue ().length == 0) {
if ($(copy_modules).attr ("checked") && $("#target_modules").fieldValue ().length == 0) {
$("#message").showMessage ("<?php echo __('No modules have been selected') ?>");
return false;
}

View File

@ -86,7 +86,8 @@ if ($id) {
}
echo '</div>';
echo '</form>';
$config['js'][] = 'pandora_alerts';
require_javascript_file ('pandora_alerts');
?>
<script type="text/javascript">

View File

@ -104,7 +104,7 @@ if ($update_layout) {
$result = process_sql_update ('tlayout',
array ('name' => $name, 'background' => $background,
'height' => $height, 'width' => $width),
array ('id' => $id));
array ('id' => $id_layout));
if ($result) {
echo '<h3 class="suc">'.__('Update layout successful').'</h3>';
} else {

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

View File

@ -152,11 +152,12 @@ function process_manage_config ($source_id_agent, $destiny_id_agents, $copy_modu
if ($copy_alerts == false) {
$copy_alerts = (bool) get_parameter ('copy_alerts', $copy_alerts);
}
if ($copy_modules) {
if (empty ($target_modules)) {
$target_modules = (array) get_parameter ('target_modules', $target_modules);
}
if (empty ($target_modules)) {
echo '<h3 class="error">'.__('No modules have been selected').'</h3>';
return false;
@ -169,7 +170,7 @@ function process_manage_config ($source_id_agent, $destiny_id_agents, $copy_modu
foreach ($destiny_id_agents as $id_destiny_agent) {
foreach ($target_modules as $id_agent_module) {
$result = copy_agent_module_to_agent ($id_agent_module,
$id_destiny_agent);
$id_destiny_agent);
if ($result === false) {
$error = true;
@ -179,19 +180,20 @@ function process_manage_config ($source_id_agent, $destiny_id_agents, $copy_modu
$id_destiny_module = $result;
if (! isset ($alerts[$id_agent_module]))
$alerts[$id_agent_module] = get_alerts_agent_module ($id_agent_module,
true);
true);
if ($alerts[$id_agent_module] === false)
continue;
if ($copy_alerts) {
foreach ($alerts[$id_agent_module] as $alert) {
$result = copy_alert_agent_module_to_agent_module ($alert['id'],
$id_destiny_module);
if ($result === false) {
$error = true;
break;
}
if (! $copy_alerts)
continue;
foreach ($alerts[$id_agent_module] as $alert) {
$result = copy_alert_agent_module_to_agent_module ($alert['id'],
$id_destiny_module);
if ($result === false) {
$error = true;
break;
}
}
}

View File

@ -261,11 +261,26 @@ function print_input_text ($name, $value, $alt = '', $size = 50, $maxlength = 0,
*
* @return string HTML code if return parameter is true.
*/
function print_input_image ($name, $src, $value, $style = '', $return = false) {
function print_input_image ($name, $src, $value, $style = '', $return = false, $options = false) {
static $idcounter = 0;
++$idcounter;
$output = '<input id="image-'.$name.$idcounter.'" src="'.$src.'" style="'.$style.'" name="'.$name.'" type="image" value="'.$value.'" />';
$output = '<input id="image-'.$name.$idcounter.'" src="'.$src.'" style="'.$style.'" name="'.$name.'" type="image"';
//Valid attributes (invalid attributes get skipped)
$attrs = array ("alt", "accesskey", "lang", "tabindex", "title", "xml:lang",
"onclick", "ondblclick", "onmousedown", "onmouseup", "onmouseover", "onmousemove",
"onmouseout", "onkeypress", "onkeydown", "onkeyup");
foreach ($attrs as $attribute) {
if (isset ($options[$attribute])) {
$output .= $attribute.'="'.safe_input ($options[$attribute]).'" ';
}
}
$output .= 'value="'.$value;
$output .= '" />';
if ($return)
return $output;

View File

@ -912,4 +912,22 @@ function print_moduletype_icon ($id_moduletype, $return = false) {
}
return print_image ("images/".$type["icon"], $return, array ("border" => 0, "title" => $type["nombre"]));
}
/**
* Format a file size from bytes to a human readable meassure.
*
* @param int File size in bytes
* @return string Bytes converted to a human readable meassure.
*/
function format_filesize ($bytes) {
$bytes = (int) $bytes;
$strs = array ('B', 'kB', 'MB', 'GB', 'TB');
if ($bytes < 0) {
return "0 ".$strs[0];
}
$con = 1024;
$log = (int) (log ($bytes, $con));
return format_numeric ($bytes / pow ($con, $log), 1).' '.$strs[$log];
}
?>