2010-05-06 Raul Mateos <raulofpandora@gmail.com>
* include/config*.php: Updated year. Updated build. * include/functions_*.php: Updated year. Clean Code. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2674 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
404fcc4b2b
commit
797694bc5f
|
@ -1,3 +1,9 @@
|
|||
2010-05-06 Raúl Mateos <raulofpandora@gmail.com>
|
||||
|
||||
* include/config*.php: Updated year. Updated build.
|
||||
|
||||
* include/functions_*.php: Updated year. Clean Code.
|
||||
|
||||
2010-05-06 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/config.inc.php: fixed the operation require when the php file to
|
||||
|
@ -859,7 +865,7 @@
|
|||
2010-04-05 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_ui.php: changed some parts of source code in the
|
||||
functions "format_alert_row" for show column modules in general view. In the
|
||||
functions "forma Raúl Mateos <raulofpandora@gmail.com>t_alert_row" for show column modules in general view. In the
|
||||
function "pagination" added the parameter $offset_name with default value
|
||||
'offset' for to use several paginations in one page.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
|
@ -82,14 +82,14 @@
|
|||
// application. Do change according to your LDAP Schema
|
||||
//$config["auth"]["ldap_user_attr"] = array (
|
||||
// //Pandora attribute // LDAP attribute //Explanation
|
||||
// 'id_user' => 'uid', //login
|
||||
// 'lastname' => 'sn', //last (sur) name
|
||||
// 'firstname' => 'givenname', //first (given) name
|
||||
// 'fullname' => 'cn', //full (common) name
|
||||
// 'id_user' => 'uid', //login
|
||||
// 'lastname' => 'sn', //last (sur) name
|
||||
// 'firstname' = 'givenname', //first (given) name
|
||||
// 'fullname' => 'cn', //full (common) name
|
||||
// 'comments' => 'description', //comments - you can set this to anything
|
||||
// 'last_contact' => 'lastlogin', //last login utimestamp or don't define
|
||||
// 'email' => 'mail', //email - not necessary will default to empty
|
||||
// 'phone' => 'phone', //phone
|
||||
// 'last_contact' => 'lastlogin', //last login utimestamp or don't define
|
||||
// 'email' => 'mail', //email - not necessary will default to empty
|
||||
// 'phone' => 'phone', //phone
|
||||
// 'middlename' => 'mn', //not yet used except for representational purposes
|
||||
// 'registered' => 'created' //created utimestamp or don't define
|
||||
//);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// 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
|
||||
|
@ -22,7 +22,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC10408'; // Remember is YYMMDD
|
||||
$build_version = 'PC100506'; // Remember is YYMMDD
|
||||
$pandora_version = 'v3.1-dev';
|
||||
|
||||
/* Help to debug problems. Override global PHP configuration */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// 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
|
||||
|
@ -731,7 +731,7 @@ function is_module_proc ($module_name) {
|
|||
* @return bool true if the module is of type "inc"
|
||||
*/
|
||||
function is_module_inc ($module_name) {
|
||||
return preg_match ('/\_inc$/', $module_name);
|
||||
return preg_match ('/\_inc$/', $module_name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// 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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// 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
|
||||
|
@ -412,7 +412,7 @@ function delete_alert_agent_module ($id_alert_agent_module, $filter = false) {
|
|||
$filter['id'] = $id_alert_agent_module;
|
||||
|
||||
if ($id_alert_agent_module !== false) {
|
||||
$idAlertCompunds = get_db_all_rows_sql('SELECT id_alert_compound
|
||||
$idAlertCompunds = get_db_all_rows_sql('SELECT id_alert_compound
|
||||
FROM talert_compound_elements
|
||||
WHERE id_alert_template_module = ' . $id_alert_agent_module);
|
||||
|
||||
|
@ -828,7 +828,7 @@ function get_agents_with_alert_template ($id_alert_template, $id_group, $filter
|
|||
if (! is_array ($filter))
|
||||
$filter = array ();
|
||||
$filter[] = 'tagente_modulo.id_agente_modulo = talert_template_modules.id_agent_module';
|
||||
$filter[] = 'tagente_modulo.id_agente = tagente.id_agente';
|
||||
$filter[] = 'tagente_modulo.id_agente = tagente.id_agente';
|
||||
$filter['id_alert_template'] = $id_alert_template;
|
||||
$filter['`tagente`.id_agente'] = array_keys (get_group_agents ($id_group, false, "none"));
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
|
@ -92,9 +92,9 @@ function update_config_value ($token, $value) {
|
|||
break;
|
||||
default:
|
||||
if (!isset ($config[$token])){
|
||||
$config[$token] = $value;
|
||||
$config[$token] = $value;
|
||||
return (bool) create_config_value ($token, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/* If it has not changed */
|
||||
if ($config[$token] == $value)
|
||||
|
@ -171,8 +171,8 @@ function update_config () {
|
|||
update_config_value ('history_db_delay', (string) get_parameter ('history_db_delay', $config['history_db_delay']));
|
||||
update_config_value ('timezone', (string) get_parameter ('timezone', $config['timezone']));
|
||||
update_config_value ('activate_gis', (bool) get_parameter ('activate_gis', $config['activate_gis']));
|
||||
update_config_value ('stats_interval', get_parameter ('stats_interval', $config['stats_interval']));
|
||||
update_config_value ('realtimestats', get_parameter ('realtimestats', $config['realtimestats']));
|
||||
update_config_value ('stats_interval', get_parameter ('stats_interval', $config['stats_interval']));
|
||||
update_config_value ('realtimestats', get_parameter ('realtimestats', $config['realtimestats']));
|
||||
update_config_value ('event_purge', get_parameter ('event_purge', $config['event_purge']));
|
||||
update_config_value ('trap_purge', get_parameter ('trap_purge', $config['trap_purge']));
|
||||
update_config_value ('string_purge', get_parameter ('string_purge', $config['string_purge']));
|
||||
|
@ -336,7 +336,7 @@ function process_config () {
|
|||
|
||||
// if (!isset ($config["autoupdate"])){
|
||||
// update_config_value ('autoupdate', true);
|
||||
// }
|
||||
// }
|
||||
|
||||
if (!isset ($config["auth"])) {
|
||||
require_once ($config["homedir"]."/include/auth/mysql.php");
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// 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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// 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
|
||||
|
@ -302,9 +302,9 @@ function create_user_profile ($id_user, $id_profile = 1, $id_group = 0, $assignU
|
|||
$assign = $assignUser;
|
||||
|
||||
$insert = array (
|
||||
"id_usuario" => $id_user,
|
||||
"id_perfil" => $id_profile,
|
||||
"id_grupo" => $id_group,
|
||||
"id_usuario" => $id_user,
|
||||
"id_perfil" => $id_profile,
|
||||
"id_grupo" => $id_group,
|
||||
"assigned_by" => $assign
|
||||
);
|
||||
|
||||
|
@ -442,8 +442,8 @@ function get_group_agents ($id_group = 0, $search = false, $case = "lower", $noA
|
|||
|
||||
////////////////LOG AJAX///////////////////////
|
||||
///////////////////////////////////////////////
|
||||
//$log = fopen ( "/tmp/log_sql", "a");
|
||||
//fwrite ($log, $sql."\n\n");
|
||||
//$log = fopen ( "/tmp/log_sql", "a");
|
||||
//fwrite ($log, $sql."\n\n");
|
||||
//fclose($log);
|
||||
///////////////////////////////////////////////
|
||||
|
||||
|
@ -1798,7 +1798,7 @@ function get_db_row ($table, $field_search, $condition, $fields = false) {
|
|||
* Get the row of a table in the database using a complex filter.
|
||||
*
|
||||
* @param string Table to retrieve the data (warning: not cleaned)
|
||||
* @param mixed Filters elements. It can be an indexed array
|
||||
* @param mixed Filters elements. It can be an indexed array
|
||||
* (keys would be the field name and value the expected value, and would be
|
||||
* joined with an AND operator) or a string, including any SQL clause (without
|
||||
* the WHERE keyword). Example:
|
||||
|
@ -1850,15 +1850,15 @@ function get_db_row_filter ($table, $filter, $fields = false, $where_join = 'AND
|
|||
*/
|
||||
|
||||
function get_db_sql ($sql, $field = 0, $search_history_db = false) {
|
||||
$result = get_db_all_rows_sql ($sql, $search_history_db);
|
||||
if($result === false)
|
||||
return false;
|
||||
$ax = 0;
|
||||
foreach ($result[0] as $f){
|
||||
if ($field == $ax)
|
||||
return $f;
|
||||
$ax++;
|
||||
}
|
||||
$result = get_db_all_rows_sql ($sql, $search_history_db);
|
||||
if($result === false)
|
||||
return false;
|
||||
$ax = 0;
|
||||
foreach ($result[0] as $f){
|
||||
if ($field == $ax)
|
||||
return $f;
|
||||
$ax++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2214,9 +2214,9 @@ function get_db_all_fields_in_table ($table, $field = '', $condition = '', $orde
|
|||
* echo $sql;
|
||||
* </code>
|
||||
* Will return:
|
||||
* <code>
|
||||
* <code>
|
||||
* UPDATE table SET `name` = "Name", `description` = "Long description" WHERE id=1
|
||||
* </code>
|
||||
* </code>
|
||||
*
|
||||
* @param array Values to be formatted in an array indexed by the field name.
|
||||
*
|
||||
|
@ -2437,7 +2437,7 @@ function get_agentmodule_status ($id_agentmodule = 0) {
|
|||
/**
|
||||
* Get the worst status of all modules of a given agent.
|
||||
*
|
||||
* @param int Id agent to check.
|
||||
* @param int Id agent to check.
|
||||
*
|
||||
* @return int Worst status of an agent for all of its modules.
|
||||
* The value -1 is returned in case the agent has exceed its interval.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// 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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// 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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2009 Artica Soluciones Tecnologicas
|
||||
// Copyright (c) 2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
|
@ -29,18 +29,18 @@ function get_chart_code ($chart, $width, $height, $swf) {
|
|||
$random_number = rand ();
|
||||
$div_id = 'chart_div_' . $random_number;
|
||||
$chart_id = 'chart_' . $random_number;
|
||||
$output = '<div id="' . $div_id. '"></div>';
|
||||
$output .= '<script type="text/javascript">
|
||||
<!--
|
||||
$(document).ready(function pie_' . $chart_id . ' () {
|
||||
var myChart = new FusionCharts("' . $swf . '", "' . $chart_id . '", "' . $width. '", "' . $height. '", "0", "1");
|
||||
myChart.setDataXML("' . addslashes($chart->getXML ()) . '");
|
||||
myChart.addParam("WMode", "Transparent");
|
||||
myChart.render("' . $div_id . '");
|
||||
})
|
||||
-->
|
||||
</script>';
|
||||
return $output;
|
||||
$output = '<div id="' . $div_id. '"></div>';
|
||||
$output .= '<script type="text/javascript">
|
||||
<!--
|
||||
$(document).ready(function pie_' . $chart_id . ' () {
|
||||
var myChart = new FusionCharts("' . $swf . '", "' . $chart_id . '", "' . $width. '", "' . $height. '", "0", "1");
|
||||
myChart.setDataXML("' . addslashes($chart->getXML ()) . '");
|
||||
myChart.addParam("WMode", "Transparent");
|
||||
myChart.render("' . $div_id . '");
|
||||
})
|
||||
-->
|
||||
</script>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Returns a 3D bar chart
|
||||
|
@ -62,7 +62,7 @@ function fs_3d_bar_chart ($data, $width, $height) {
|
|||
$chart->addChartData($value, 'name=' . clean_flash_string($name) . ';color=95BB04');
|
||||
}
|
||||
|
||||
$chart->setChartParams('showNames=1;rotateNames=1;showValues=0;showPercentageValues=0;showLimits=0;baseFontSize=9;' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : ''));
|
||||
$chart->setChartParams('showNames=1;rotateNames=1;showValues=0;showPercentageValues=0;showLimits=0;baseFontSize=9;' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : ''));
|
||||
|
||||
// Return the code
|
||||
return get_chart_code ($chart, $width, $height, 'include/FusionCharts/FCF_Column3D.swf');
|
||||
|
@ -78,7 +78,7 @@ function fs_3d_pie_chart ($data, $width, $height) {
|
|||
|
||||
// Generate the XML
|
||||
$chart = new FusionCharts('Pie3D', $width, $height);
|
||||
$chart->setChartParams('showNames=1;showValues=0;showPercentageValues=0;baseFontSize=9');
|
||||
$chart->setChartParams('showNames=1;showValues=0;showPercentageValues=0;baseFontSize=9');
|
||||
|
||||
$empty = 1;
|
||||
foreach ($data as $name => $value) {
|
||||
|
@ -124,7 +124,7 @@ function fs_2d_area_chart ($data, $width, $height, $step = 1, $params = '') {
|
|||
$chart->addChartData($value, 'name=' . clean_flash_string($name) . ';showName=' . $show_name . ';color=95BB04');
|
||||
}
|
||||
|
||||
$chart->setChartParams('numVDivLines=' . $num_vlines . ';showAlternateVGridColor=1;showNames=1;rotateNames=1;showValues=0;baseFontSize=9;showLimits=0;showAreaBorder=1;areaBorderThickness=1;areaBorderColor=000000' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : '') . $params);
|
||||
$chart->setChartParams('numVDivLines=' . $num_vlines . ';showAlternateVGridColor=1;showNames=1;rotateNames=1;showValues=0;baseFontSize=9;showLimits=0;showAreaBorder=1;areaBorderThickness=1;areaBorderColor=000000' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : '') . $params);
|
||||
|
||||
// Return the code
|
||||
return get_chart_code ($chart, $width, $height, 'include/FusionCharts/FCF_Area2D.swf');
|
||||
|
@ -176,27 +176,27 @@ function fs_module_chart ($data, $width, $height, $avg_only = 1, $step = 10, $ti
|
|||
}
|
||||
}
|
||||
|
||||
$chart->setChartParams('animation=0;numVDivLines=' . $num_vlines . ';showAlternateVGridColor=1;showNames=1;rotateNames=1;showValues=0;baseFontSize=9;showLimits=0;showAreaBorder=1;areaBorderThickness=1;areaBorderColor=000000' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : ''));
|
||||
$chart->setChartParams('animation=0;numVDivLines=' . $num_vlines . ';showAlternateVGridColor=1;showNames=1;rotateNames=1;showValues=0;baseFontSize=9;showLimits=0;showAreaBorder=1;areaBorderThickness=1;areaBorderColor=000000' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : ''));
|
||||
|
||||
$random_number = rand ();
|
||||
$div_id = 'chart_div_' . $random_number;
|
||||
$chart_id = 'chart_' . $random_number;
|
||||
$output = '<div id="' . $div_id. '" style="z-index:1;"></div>';
|
||||
$output = '<div id="' . $div_id. '" style="z-index:1;"></div>';
|
||||
$pre_url = ($config["homeurl"] == "/") ? '' : $config["homeurl"];
|
||||
|
||||
$output .= '<script language="JavaScript" src="' . $pre_url . '/include/FusionCharts/FusionCharts.js"></script>';
|
||||
$output .= '<script type="text/javascript">
|
||||
<!--
|
||||
function pie_' . $chart_id . ' () {
|
||||
var myChart = new FusionCharts("' . $pre_url . '/include/FusionCharts/FCF_MSArea2D.swf", "' . $chart_id . '", "' . $width. '", "' . $height. '", "0", "1");
|
||||
myChart.setDataXML("' . addslashes($chart->getXML ()) . '");
|
||||
myChart.addParam("WMode", "Transparent");
|
||||
myChart.render("' . $div_id . '");
|
||||
}
|
||||
$output .= '<script type="text/javascript">
|
||||
<!--
|
||||
function pie_' . $chart_id . ' () {
|
||||
var myChart = new FusionCharts("' . $pre_url . '/include/FusionCharts/FCF_MSArea2D.swf", "' . $chart_id . '", "' . $width. '", "' . $height. '", "0", "1");
|
||||
myChart.setDataXML("' . addslashes($chart->getXML ()) . '");
|
||||
myChart.addParam("WMode", "Transparent");
|
||||
myChart.render("' . $div_id . '");
|
||||
}
|
||||
pie_' . $chart_id . ' ();
|
||||
-->
|
||||
</script>';
|
||||
return $output;
|
||||
-->
|
||||
</script>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Returns a Pandora FMS combined chart
|
||||
|
@ -246,7 +246,7 @@ function fs_combined_chart ($data, $categories, $sets, $width, $height, $type =
|
|||
}
|
||||
}
|
||||
|
||||
$chart->setChartParams('animation=0;numVDivLines=' . $num_vlines . ';showAlternateVGridColor=1;showNames=1;rotateNames=1;showValues=0;baseFontSize=9;showLimits=0;showAreaBorder=1;areaBorderThickness=1;areaBorderColor=000000' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : ''));
|
||||
$chart->setChartParams('animation=0;numVDivLines=' . $num_vlines . ';showAlternateVGridColor=1;showNames=1;rotateNames=1;showValues=0;baseFontSize=9;showLimits=0;showAreaBorder=1;areaBorderThickness=1;areaBorderColor=000000' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : ''));
|
||||
|
||||
// Return the code
|
||||
return get_chart_code ($chart, $width, $height, 'include/FusionCharts/FCF_' . $chart_type . '.swf');
|
||||
|
@ -275,7 +275,7 @@ function fs_agent_event_chart ($data, $width, $height, $step = 1) {
|
|||
$chart->addChartData(1, 'name=' . clean_flash_string($name) . ';showName=' . $show_name . ';color=' . $value);
|
||||
}
|
||||
|
||||
$chart->setChartParams('numDivLines=0;numVDivLines=0;showNames=1;rotateNames=0;showValues=0;baseFontSize=9;showLimits=0;showAreaBorder=0;areaBorderThickness=1;canvasBgColor=9ABD18');
|
||||
$chart->setChartParams('numDivLines=0;numVDivLines=0;showNames=1;rotateNames=0;showValues=0;baseFontSize=9;showLimits=0;showAreaBorder=0;areaBorderThickness=1;canvasBgColor=9ABD18');
|
||||
|
||||
// Return the code
|
||||
return get_chart_code ($chart, $width, $height, 'include/FusionCharts/FCF_Area2D.swf');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// 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
|
||||
|
@ -148,51 +148,50 @@ function makeLayer($name, $visible = true, $dot = null, $idLayer = null) {
|
|||
|
||||
//Creamos la capa de tipo vector
|
||||
var layer = new OpenLayers.Layer.Vector(
|
||||
'<?php echo $name; ?>', {styleMap: style}
|
||||
);
|
||||
'<?php echo $name; ?>', {styleMap: style}
|
||||
);
|
||||
|
||||
layer.data = {};
|
||||
layer.data.id = '<?php echo $idLayer; ?>';
|
||||
layer.data = {};
|
||||
layer.data.id = '<?php echo $idLayer; ?>';
|
||||
|
||||
layer.setVisibility(<?php echo $visible; ?>);
|
||||
map.addLayer(layer);
|
||||
|
||||
layer.events.on({
|
||||
"featureselected": function(e) {
|
||||
if (e.feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
|
||||
var feature = e.feature;
|
||||
var featureData = feature.data;
|
||||
var long_lat = featureData.long_lat;
|
||||
layer.setVisibility(<?php echo $visible; ?>);
|
||||
map.addLayer(layer);
|
||||
|
||||
layer.events.on({
|
||||
"featureselected": function(e) {
|
||||
if (e.feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
|
||||
var feature = e.feature;
|
||||
var featureData = feature.data;
|
||||
var long_lat = featureData.long_lat;
|
||||
var popup;
|
||||
|
||||
popup = new OpenLayers.Popup.FramedCloud('cloud00',
|
||||
long_lat,
|
||||
popup = new OpenLayers.Popup.FramedCloud('cloud00',
|
||||
long_lat,
|
||||
null,
|
||||
'<div class="cloudContent' + featureData.id + '" style="text-align: center;"><img src="images/spinner.gif" /></div>',
|
||||
null,
|
||||
true,
|
||||
function () { popup.destroy(); });
|
||||
feature.popup = popup;
|
||||
map.addPopup(popup);
|
||||
feature.popup = popup;
|
||||
map.addPopup(popup);
|
||||
|
||||
jQuery.ajax ({
|
||||
data: "page=operation/gis_maps/ajax&opt="+featureData.type+"&id=" + featureData.id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
url: "ajax.php",
|
||||
timeout: 10000,
|
||||
success: function (data) {
|
||||
if (data.correct) {
|
||||
$('.cloudContent' + featureData.id).css('text-align', 'left');
|
||||
$('.cloudContent' + featureData.id).html(data.content);
|
||||
popup.updateSize();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
jQuery.ajax ({
|
||||
data: "page=operation/gis_maps/ajax&opt="+featureData.type+"&id=" + featureData.id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
url: "ajax.php",
|
||||
timeout: 10000,
|
||||
success: function (data) {
|
||||
if (data.correct) {
|
||||
$('.cloudContent' + featureData.id).css('text-align', 'left');
|
||||
$('.cloudContent' + featureData.id).html(data.content);
|
||||
popup.updateSize();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
@ -204,11 +203,10 @@ function activateSelectControl($layers=null) {
|
|||
<script type="text/javascript">
|
||||
$(document).ready (
|
||||
function () {
|
||||
var layers = map.getLayersByClass("OpenLayers.Layer.Vector");
|
||||
|
||||
var select = new OpenLayers.Control.SelectFeature(layers);
|
||||
map.addControl(select);
|
||||
select.activate();
|
||||
var layers = map.getLayersByClass("OpenLayers.Layer.Vector");
|
||||
var select = new OpenLayers.Control.SelectFeature(layers);
|
||||
map.addControl(select);
|
||||
select.activate();
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
@ -216,7 +214,7 @@ function activateSelectControl($layers=null) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Activate the feature refresh by ajax.
|
||||
* Activate the feature refresh by ajax.
|
||||
*
|
||||
* @param Array $layers Its a rows of table "tgis_map_layer" or None is all.
|
||||
* @param integer $lastTimeOfData The time in unix timestamp of last query of data GIS in DB.
|
||||
|
@ -257,41 +255,40 @@ function activateAjaxRefresh($layers = null, $lastTimeOfData = null) {
|
|||
}
|
||||
|
||||
if (featureIdArray.length > 0) {
|
||||
jQuery.ajax ({
|
||||
data: "page=operation/gis_maps/ajax&opt=get_new_positions&id_features=" + featureIdArray.toString()
|
||||
+ "&last_time_of_data=" + last_time_of_data + "&layer_id=" + layer.data.id + "&agent_view=" + agentView,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
url: "ajax.php",
|
||||
timeout: 10000,
|
||||
success: function (data) {
|
||||
if (data.correct) {
|
||||
content = $.evalJSON(data.content);
|
||||
jQuery.ajax ({
|
||||
data: "page=operation/gis_maps/ajax&opt=get_new_positions&id_features=" + featureIdArray.toString()
|
||||
+ "&last_time_of_data=" + last_time_of_data + "&layer_id=" + layer.data.id + "&agent_view=" + agentView,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
url: "ajax.php",
|
||||
timeout: 10000,
|
||||
success: function (data) {
|
||||
if (data.correct) {
|
||||
content = $.evalJSON(data.content);
|
||||
|
||||
if (content != null) {
|
||||
for (var idAgent in content) {
|
||||
if (isInt(idAgent)) {
|
||||
agentDataGIS = content[idAgent];
|
||||
|
||||
feature = searchPointAgentById(idAgent);
|
||||
layer.removeFeatures(feature);
|
||||
|
||||
delete feature;
|
||||
feature = null
|
||||
status = parseInt(agentDataGIS['status']);
|
||||
if (content != null) {
|
||||
for (var idAgent in content) {
|
||||
if (isInt(idAgent)) {
|
||||
agentDataGIS = content[idAgent];
|
||||
feature = searchPointAgentById(idAgent);
|
||||
layer.removeFeatures(feature);
|
||||
|
||||
delete feature;
|
||||
feature = null
|
||||
status = parseInt(agentDataGIS['status']);
|
||||
|
||||
js_addAgentPointExtent(layer.name, agentDataGIS['name'],
|
||||
agentDataGIS['stored_longitude'], agentDataGIS['stored_latitude'],
|
||||
agentDataGIS['icon_path'], 20, 20, idAgent, 'point_agent_info', status, agentDataGIS['id_parent']);
|
||||
js_addAgentPointExtent(layer.name, agentDataGIS['name'],
|
||||
agentDataGIS['stored_longitude'], agentDataGIS['stored_latitude'],
|
||||
agentDataGIS['icon_path'], 20, 20, idAgent, 'point_agent_info', status, agentDataGIS['id_parent']);
|
||||
|
||||
//TODO: Optimize, search a new position to call for all agent in the layer and or optimice code into function.
|
||||
js_refreshParentLines();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//TODO: Optimize, search a new position to call for all agent in the layer and or optimice code into function.
|
||||
js_refreshParentLines();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -339,7 +336,7 @@ function activateAjaxRefresh($layers = null, $lastTimeOfData = null) {
|
|||
}
|
||||
|
||||
function addAgentPoint($layerName, $pointName, $lat, $lon, $icon = null, $width = 20,
|
||||
$height = 20, $point_id = '', $status = -1, $type_string = '', $idParent = 0) {
|
||||
$height = 20, $point_id = '', $status = -1, $type_string = '', $idParent = 0) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready (
|
||||
|
@ -672,7 +669,7 @@ function saveMap($map_name, $map_initial_longitude, $map_initial_latitude,
|
|||
process_sql_insert('tgis_map_has_tgis_map_connection',
|
||||
array(
|
||||
'tgis_map_id_tgis_map' => $idMap,
|
||||
'tgis_map_connection_id_tmap_connection' => $map_connection['id_conection'],
|
||||
'tgis_map_connection_id_tmap_connection' => $map_connection['id_conection'],
|
||||
'default_map_connection' => $map_connection['default']
|
||||
)
|
||||
);
|
||||
|
@ -726,7 +723,7 @@ function updateMap($idMap, $map_name, $map_initial_longitude, $map_initial_latit
|
|||
process_sql_insert('tgis_map_has_tgis_map_connection',
|
||||
array(
|
||||
'tgis_map_id_tgis_map' => $idMap,
|
||||
'tgis_map_connection_id_tmap_connection' => $map_connection['id_conection'],
|
||||
'tgis_map_connection_id_tmap_connection' => $map_connection['id_conection'],
|
||||
'default_map_connection' => $map_connection['default']
|
||||
)
|
||||
);
|
||||
|
@ -774,8 +771,8 @@ function updateMap($idMap, $map_name, $map_initial_longitude, $map_initial_latit
|
|||
*
|
||||
* @result: An array with all the configuration parameters
|
||||
*/
|
||||
function getConectionConf($idConnection) {
|
||||
$confParameters = get_db_row_sql('SELECT * FROM tgis_map_connection WHERE id_tmap_connection = ' . $idConnection);
|
||||
function getConectionConf($idConnection) {
|
||||
$confParameters = get_db_row_sql('SELECT * FROM tgis_map_connection WHERE id_tmap_connection = ' . $idConnection);
|
||||
return $confParameters;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// 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
|
||||
|
@ -247,7 +247,7 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
|
|||
* The element will have an id like: "password-$value". Based on choose_from_menu() from Moodle.
|
||||
*
|
||||
* @param string $sql SQL sentence, the first field will be the identifier of the option.
|
||||
* The second field will be the shown value in the dropdown.
|
||||
* The second field will be the shown value in the dropdown.
|
||||
* @param string $name Select form name
|
||||
* @param string $selected Current selected value.
|
||||
* @param string $script Javascript onChange code.
|
||||
|
@ -604,31 +604,31 @@ function print_textarea ($name, $rows, $columns, $value = '', $attributes = '',
|
|||
* Print a nicely formatted table. Code taken from moodle.
|
||||
*
|
||||
* @param object Object with several properties:
|
||||
* $table->head - An array of heading names.
|
||||
* $table->head_colspan - An array of colspans of each head column.
|
||||
* $table->align - An array of column alignments
|
||||
* $table->valign - An array of column alignments
|
||||
* $table->size - An array of column sizes
|
||||
* $table->wrap - An array of "nowrap"s or nothing
|
||||
* $table->style - An array of personalized style for each column.
|
||||
* $table->rowstyle - An array of personalized style of each row.
|
||||
* $table->rowclass - An array of personalized classes of each row (odd-evens classes will be ignored).
|
||||
* $table->colspan - An array of colspans of each column.
|
||||
* $table->rowspan - An array of rowspans of each column.
|
||||
* $table->data[] - An array of arrays containing the data.
|
||||
* $table->width - A percentage of the page
|
||||
* $table->border - Border of the table.
|
||||
* $table->tablealign - Align the whole table (float left or right)
|
||||
* $table->cellpadding - Padding on each cell
|
||||
* $table->cellspacing - Spacing between cells
|
||||
* $table->class - CSS table class
|
||||
* $table->id - Table ID (useful in JavaScript)
|
||||
* $table->headclass[] - An array of classes for each heading
|
||||
* $table->title - Title of the table is a single string that will be on top of the table in the head spanning the whole table
|
||||
* $table->titlestyle - Title style
|
||||
* $table->titleclass - Title class
|
||||
* $table->styleTable - Table style
|
||||
* @param bool Whether to return an output string or echo now
|
||||
* $table->head - An array of heading names.
|
||||
* $table->head_colspan - An array of colspans of each head column.
|
||||
* $table->align - An array of column alignments
|
||||
* $table->valign - An array of column alignments
|
||||
* $table->size - An array of column sizes
|
||||
* $table->wrap - An array of "nowrap"s or nothing
|
||||
* $table->style - An array of personalized style for each column.
|
||||
* $table->rowstyle - An array of personalized style of each row.
|
||||
* $table->rowclass - An array of personalized classes of each row (odd-evens classes will be ignored).
|
||||
* $table->colspan - An array of colspans of each column.
|
||||
* $table->rowspan - An array of rowspans of each column.
|
||||
* $table->data[] - An array of arrays containing the data.
|
||||
* $table->width - A percentage of the page
|
||||
* $table->border - Border of the table.
|
||||
* $table->tablealign - Align the whole table (float left or right)
|
||||
* $table->cellpadding - Padding on each cell
|
||||
* $table->cellspacing - Spacing between cells
|
||||
* $table->class - CSS table class
|
||||
* $table->id - Table ID (useful in JavaScript)
|
||||
* $table->headclass[] - An array of classes for each heading
|
||||
* $table->title - Title of the table is a single string that will be on top of the table in the head spanning the whole table
|
||||
* $table->titlestyle - Title style
|
||||
* $table->titleclass - Title class
|
||||
* $table->styleTable - Table style
|
||||
* @param bool Whether to return an output string or echo now
|
||||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
|
@ -819,7 +819,7 @@ function print_table (&$table, $return = false) {
|
|||
$style[$key] = '';
|
||||
}
|
||||
|
||||
$output .= '<td id="'.$tableid.'-'.$keyrow.'-'.$key.'" style="'. $style[$key].$valign[$key].$align[$key].$size[$key].$wrap[$key] .'" '.$colspan[$keyrow][$key].' '.$rowspan[$keyrow][$key].' class="'.$class.'">'. $item .'</td>'."\n";
|
||||
$output .= '<td id="'.$tableid.'-'.$keyrow.'-'.$key.'" style="'. $style[$key].$valign[$key].$align[$key].$size[$key].$wrap[$key] .'" '.$colspan[$keyrow][$key].' '.$rowspan[$keyrow][$key].' class="'.$class.'">'. $item .'</td>'."\n";
|
||||
}
|
||||
$output .= '</tr>'."\n";
|
||||
}
|
||||
|
@ -870,7 +870,7 @@ function print_radio_button_extended ($name, $value, $label, $checkedvalue, $dis
|
|||
$output .= ' />';
|
||||
|
||||
if ($label != '') {
|
||||
$output .= '<label for="'.$htmlid.'">'. $label .'</label>' . "\n";
|
||||
$output .= '<label for="'.$htmlid.'">'. $label .'</label>' . "\n";
|
||||
}
|
||||
|
||||
if ($return)
|
||||
|
|
Loading…
Reference in New Issue