2010-02-23 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_gis.php: in function "activateAjaxRefresh" add the
	posibility to change refresh time in execution time.
	
	* include/functions_ui.php: add in the "print_page_header" the feature to
	pass a array of buttons/items.

	* include/javascript/openlayers.pandora.js: add the function
	"changeRefreshTime" for change the refresh time.

	* operation/gis_maps/render_view.php: change the top of page for to
	adapt the new header, and add refresh control.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2408 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2010-02-23 16:36:24 +00:00
parent 6448be331c
commit 132ab90b41
6 changed files with 165 additions and 18 deletions

View File

@ -1,3 +1,17 @@
2010-02-23 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_gis.php: in function "activateAjaxRefresh" add the
posibility to change refresh time in execution time.
* include/functions_ui.php: add in the "print_page_header" the feature to
pass a array of buttons/items.
* include/javascript/openlayers.pandora.js: add the function
"changeRefreshTime" for change the refresh time.
* operation/gis_maps/render_view.php: change the top of page for to
adapt the new header, and add refresh control.
2010-02-23 Pablo de la Concepción <pablo.concepcion@artica.es> 2010-02-23 Pablo de la Concepción <pablo.concepcion@artica.es>
* godmode/setup/gis_step_2.php, godmode/gis_maps/configure_gis_map.php: * godmode/setup/gis_step_2.php, godmode/gis_maps/configure_gis_map.php:

View File

@ -214,6 +214,7 @@ function activateAjaxRefresh($layers = null, $lastTimeOfData = null) {
var last_time_of_data = <?php echo $lastTimeOfData; ?>; //This time use in the ajax query to next recent points. var last_time_of_data = <?php echo $lastTimeOfData; ?>; //This time use in the ajax query to next recent points.
var refreshAjaxIntervalSeconds = 6000; var refreshAjaxIntervalSeconds = 6000;
var idIntervalAjax = null; var idIntervalAjax = null;
var oldRefreshAjaxIntervalSeconds = 6000;
<?php <?php
if ($layers === null) { if ($layers === null) {
@ -296,7 +297,12 @@ function activateAjaxRefresh($layers = null, $lastTimeOfData = null) {
} }
last_time_of_data = Math.round(new Date().getTime() / 1000); //Unixtimestamp last_time_of_data = Math.round(new Date().getTime() / 1000); //Unixtimestamp
//clearInterval(idIntervalAjax); //Test if the user change the refresh time.
if (oldRefreshAjaxIntervalSeconds != refreshAjaxIntervalSeconds) {
clearInterval(idIntervalAjax);
idIntervalAjax = setInterval("clock_ajax_refresh()", refreshAjaxIntervalSeconds);
oldRefreshAjaxIntervalSeconds = refreshAjaxIntervalSeconds;
}
} }
$(document).ready ( $(document).ready (

View File

@ -1386,11 +1386,22 @@ function print_page_header ($title, $icon = "", $return = false, $help = "", $go
$buffer .= "&nbsp;&nbsp;" . print_help_icon ($help, true); $buffer .= "&nbsp;&nbsp;" . print_help_icon ($help, true);
$buffer .= '</ul></div>'; $buffer .= '</ul></div>';
if (is_array($options)) {
$buffer .= '<div id="menu_tab"><ul class="mn">';
foreach ($options as $option) {
$buffer .= '<li class="nomn">';
$buffer .= $option;
$buffer .= '</li>';
}
$buffer .= '</ul></div>';
}
else {
if ($options != ""){ if ($options != ""){
$buffer .= '<div id="menu_tab"><ul class="mn"><li class="nomn">'; $buffer .= '<div id="menu_tab"><ul class="mn"><li class="nomn">';
$buffer .= $options; $buffer .= $options;
$buffer .= '</li></ul></div>'; $buffer .= '</li></ul></div>';
} }
}
$buffer .= '</div><br><br><br>'; $buffer .= '</div><br><br><br>';

View File

@ -93,6 +93,16 @@ function js_printMap(id_div, initial_zoom, num_levels_zoom, center_latitude, cen
); );
} }
/**
* Change the refresh time for the map.
*
* @param int time seconds
* @return none
*/
function changeRefreshTime(time) {
refreshAjaxIntervalSeconds = time * 1000;
}
/** /**
* Make the layer in the map. * Make the layer in the map.
* *

View File

@ -48,24 +48,39 @@ $controls = array('PanZoom', 'ScaleLine', 'Navigation', 'MousePosition', 'Overvi
$layers = getLayers($idMap); $layers = getLayers($idMap);
// Render map // Render map
echo "<h2>".__('Visual console')." &raquo; ".__('Map');
echo "&nbsp;" . $map['map_name'] . "&nbsp;&nbsp;"; $buttons = array();
if ($config["pure"] == 0) { if ($config["pure"] == 0) {
echo '<a href="index.php?sec=visualc&amp;sec2=operation/gis_maps/render_view&amp;map_id='.$idMap.'&amp;refr='.$config["refr"].'&amp;pure=1">'; $buttons[] = '<a href="index.php?sec=visualc&amp;sec2=operation/gis_maps/render_view&amp;map_id='.$idMap.'&amp;refr='.$config["refr"].'&amp;pure=1">' .
print_image ("images/fullscreen.png", false, array ("title" => __('Full screen mode'))); print_image ("images/fullscreen.png", true, array ("title" => __('Full screen mode'))) . "</a>";
echo "</a>"; }
} else { else {
echo '<a href="index.php?sec=visualc&amp;sec2=operation/gis_maps/render_view&amp;map_id='.$idMap.'&amp;refr='.$config["refr"].'">'; $buttons[] = '<a href="index.php?sec=visualc&amp;sec2=operation/gis_maps/render_view&amp;map_id='.$idMap.'&amp;refr='.$config["refr"].'">' .
print_image ("images/normalscreen.png", false, array ("title" => __('Back to normal mode'))); print_image ("images/normalscreen.png", true, array ("title" => __('Back to normal mode'))) . "</a>";
echo "</a>";
} }
echo "&nbsp;";
if (give_acl ($config["id_user"], $map['group_id'], "AW")) if (give_acl ($config["id_user"], $map['group_id'], "AW"))
echo '<a href="index.php?sec=gismaps&sec2=operation/gis_maps/render_view&map_id='. $idMap.'">'.print_image ("images/setup.png", true, array ("title" => __('Setup'))).'</a>'; $buttons [] = '<a href="index.php?sec=gismaps&sec2=operation/gis_maps/render_view&map_id='. $idMap.'">'.print_image ("images/setup.png", true, array ("title" => __('Setup'))).'</a>';
echo "</h2>";
$buttonsString = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3"><img src="images/bricks.png" class="top" border="0">&nbsp; Agent&nbsp;-&nbsp;test_gis1</a></li></ul></div><div id="menu_tab"><ul class="mn"><li class="nomn"><a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;id_agente=3"><img src="images/setup.png" class="top" title="Manage" border="0" width="16">&nbsp;</a></li><li class="nomn_high"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3"><img src="images/monitor.png" class="top" title="Main" border="0">&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3&amp;tab=data"><img src="images/lightbulb.png" class="top" title="Data" border="0">&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3&amp;tab=alert"><img src="images/bell.png" class="top" title="Alerts" border="0">&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=sla&amp;id_agente=3"><img src="images/images.png" class="top" title="S.L.A." border="0">&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;group_id=2"><img src="images/agents_group.png" class="top" title="Group" border="0">&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=inventory&amp;id_agente=3"><img src="images/page_white_text.png" class="top" title="Inventory" border="0" width="16">&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=gis&amp;id_agente=3"><img src="images/world.png" class="top" title="GIS data" border="0">&nbsp;</a>';
$times = array(
5 => 5 . ' ' . __('seconds'),
10 => 10 . ' ' . __('seconds'),
30 => 30 . ' ' . __('seconds'),
60 => 1 . ' ' . __('minute'),
120 => 2 . ' ' . __('minutes'),
300 => 5 . ' ' . __('minutes'),
600 => 10 . ' ' . __('minutes'),
3600 => 1 . ' ' . __('hour'),
7200 => 2 . ' ' . __('hours')
);
$buttons[] = __('Refresh: ') . print_select($times, 'refresh_time', 60, 'changeRefreshTime(this.value);', '', 0, true, false, false);
print_page_header(__('Visual console') . " &raquo; " . __('Map') . "&nbsp;" . $map['map_name'], "", false, "", false, $buttons);
printMap('map', $map['zoom_level'], $numZoomLevels, $map['initial_latitude'], printMap('map', $map['zoom_level'], $numZoomLevels, $map['initial_latitude'],
$map['initial_longitude'], $baselayers, $controls); $map['initial_longitude'], $baselayers, $controls);

View File

@ -0,0 +1,91 @@
Pandora FMS XML Stress
======================
This is a small script that generates XML data files like the ones sent by
Pandora FMS agents.
The scripts reads agent names from a text file and generates XML data files for
each agent according to a configuration file, where modules are defined as
templates.
Modules are filled with random data. An initial value and the probability of
the module data changing may be specified.
Run the script like this:
./pandora_xml_stress <configuration file>
Sample configuration file
=========================
# Maximum number of threads, by default 10.
max_threads 10
# File containing a list of agent names (one per line).
agent_file agent_names.txt
# Directory where XML data files will be placed, by default /tmp.
temporal /var/spool/pandora/data_in
# Pandora FMS XML Stress log file, logs to stdout by default.
log_file pandora_xml_stress.log
# XML version, by default 1.0.
xml_version 1.0
# XML encoding, by default ISO-8859-1.
encoding ISO-8859-1
# Operating system (shared by all agents), by default Linux.
os_name Linux
# Operating system version (shared by all agents), by default 2.6.
os_version 2.6
# Agent interval, by default 300.
agent_interval 300
# Data file generation start date, by default now.
#time_from 2009-06-01 00:00:00
# Data file generation end date, by default now.
#time_to 2009-06-05 00:00:00
# Delay after generating the first data file for each agent to avoid
# race conditions when auto-creating the agent, by default 2.
startup_delay 2
# Timezone offset: Difference with the server timezone
timezone_offset 0
# Agent position paramters
# Those parameters define the center and the zone where the agents will be
# randomly located.
# The base parameters define the central point of the sistem and the radius
# defines how far from that point the agents will be placed in any direction
# Base latitude reference for all agents
latitude_base 40.42056
# Base longitude reference for all agents
longitude_base -3.708187
# Base altitude reference for all agents
altitude_base 0
# This amount divided by 100 defines how far from each reference coordinate
# the agents will go
position_radius 10
# Address of the Tentacle server where XML files will be sent (optional).
# server_ip 192.168.50.1
# Port of the Tentacle server, by default 41121.
# server_port 41121
# Module definitions. Similar to pandora_agent.conf.
module_begin
module_name Module_3
module_type generic_proc
module_descripcion Module 3 description.
# Initial data.
module_data 1
module_end