2009-06-30 Ramon Novoa <rnovoa@artica.es>
* nclude/FusionCharts, include/FusionCharts/FCF_Column3D.swf, include/FusionCharts/FCF_Pie3D.swf, include/FusionCharts/FusionCharts.js, include/FusionCharts/FCF_MSLine.swf, include/FusionCharts/FusionCharts_Gen.php, include/FusionCharts/FCF_StackedArea2D.swf, include/FusionCharts/FCF_Area2D.swf, include/FusionCharts/FCF_MSArea2D.swf, include/FusionCharts/FusionCharts.php: Added to repository. Fusion Charts Free. * include/functions_fsgraph.php: Added to repository. Fusion Charts chart generation functions for Pandora FMS. * include/pchart_graph.php, include/pandora_graph.php, include/fgraph2.php, include/pChart, include/Image, include/fgraph.php: Moved from reporting to include. * operation/agentes/stat_win.php: Moved from reporting to operation/agentes. * reporting: Deleted from repository. * general/logon_ok.php, godmode/setup/setup.php, godmode/admin_access_logs.php, godmode/db/db_main.php, godmode/db/db_info.php, godmode/db/db_purge.php, godmode/reporting/graph_builder.php, operation/reporting/reporting_xml.php, operation/reporting/reporting_viewer.php, operation/servers/view_server.php, operation/servers/view_server_detail.php, operation/incidents/incident_statistics.php operation/users/user_statistics.php, operation/events/event_statistics.php, operation/events/events.php, operation/agentes/estado_ultimopaquete.php, operation/agentes/estado_generalagente.php, operation/agentes/tactical.php, include/functions_config.php, include/functions_custom_graphs.php, include/functions_visual_map.php, include/functions_reporting.php: Added flash charts. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1779 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
ca040599a3
commit
6bf21b276f
|
@ -1,3 +1,48 @@
|
|||
2009-06-30 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* include/FusionCharts,
|
||||
include/FusionCharts/FCF_Column3D.swf,
|
||||
include/FusionCharts/FCF_Pie3D.swf,
|
||||
include/FusionCharts/FusionCharts.js,
|
||||
include/FusionCharts/FCF_MSLine.swf,
|
||||
include/FusionCharts/FusionCharts_Gen.php,
|
||||
include/FusionCharts/FCF_StackedArea2D.swf,
|
||||
include/FusionCharts/FCF_Area2D.swf,
|
||||
include/FusionCharts/FCF_MSArea2D.swf,
|
||||
include/FusionCharts/FusionCharts.php: Added to repository. Fusion
|
||||
Charts Free.
|
||||
|
||||
* include/functions_fsgraph.php: Added to repository. Fusion Charts
|
||||
chart generation functions for Pandora FMS.
|
||||
|
||||
* include/pchart_graph.php, include/pandora_graph.php,
|
||||
include/fgraph2.php, include/pChart, include/Image,
|
||||
include/fgraph.php: Moved from reporting to include.
|
||||
|
||||
* operation/agentes/stat_win.php: Moved from reporting to
|
||||
operation/agentes.
|
||||
|
||||
* reporting: Deleted from repository.
|
||||
|
||||
* general/logon_ok.php, godmode/setup/setup.php,
|
||||
godmode/admin_access_logs.php, godmode/db/db_main.php,
|
||||
godmode/db/db_info.php, godmode/db/db_purge.php,
|
||||
godmode/reporting/graph_builder.php,
|
||||
operation/reporting/reporting_xml.php,
|
||||
operation/reporting/reporting_viewer.php,
|
||||
operation/servers/view_server.php,
|
||||
operation/servers/view_server_detail.php,
|
||||
operation/incidents/incident_statistics.php
|
||||
operation/users/user_statistics.php,
|
||||
operation/events/event_statistics.php, operation/events/events.php,
|
||||
operation/agentes/estado_ultimopaquete.php,
|
||||
operation/agentes/estado_generalagente.php,
|
||||
operation/agentes/tactical.php, include/functions_config.php,
|
||||
include/functions_custom_graphs.php,
|
||||
include/functions_visual_map.php,
|
||||
include/functions_reporting.php: Added flash charts.
|
||||
|
||||
|
||||
2009-06-29 Jorge Gonzalez <jorgegonz@artica.es>
|
||||
|
||||
* include/languages/index.pot: Updated po template.
|
||||
|
|
|
@ -64,7 +64,7 @@ $table->head = array ();
|
|||
$table->data = array ();
|
||||
$table->width = "100%";
|
||||
|
||||
$img = "reporting/fgraph.php?tipo=progress&height=20&width=280&mode=0&percent=";
|
||||
$img = "include/fgraph.php?tipo=progress&height=20&width=280&mode=0&percent=";
|
||||
|
||||
$table->data[0][0] ='<b>'.__('Monitor health').'</b>';
|
||||
$table->data[1][0] = print_image ($img.$data["monitor_health"], true, array ("title" => $data["monitor_health"].'% '.__('of monitors up')));
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
|
||||
|
||||
require_once ("include/config.php");
|
||||
if ($config['flash_charts']) {
|
||||
require_once ("include/fgraph.php");
|
||||
}
|
||||
|
||||
check_login ();
|
||||
|
||||
|
@ -52,7 +55,11 @@ echo '<br /><noscript><input name="uptbutton" type="submit" class="sub" value="'
|
|||
echo '</form></div>';
|
||||
|
||||
echo '<div style="width:300px; height:140px; float:left;">';
|
||||
echo '<img src="reporting/fgraph.php?tipo=user_activity&width=300&height=140" />';
|
||||
if ($config['flash_charts']) {
|
||||
echo graphic_user_activity (300, 140);
|
||||
} else {
|
||||
echo '<img src="include/fgraph.php?tipo=user_activity&width=300&height=140" />';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
$filter = '';
|
||||
|
@ -106,4 +113,4 @@ foreach ($result as $row) {
|
|||
|
||||
print_table ($table);
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
|
||||
// Load global vars
|
||||
require_once ("include/config.php");
|
||||
if ($config['flash_charts']) {
|
||||
require('include/fgraph.php');
|
||||
}
|
||||
|
||||
check_login ();
|
||||
|
||||
|
@ -42,11 +45,19 @@ echo '<div id="db_info_graph">';
|
|||
echo '<table border=0>';
|
||||
echo '<tr><td>';
|
||||
echo '<h3>'.__('Modules per agent').'</h3>';
|
||||
echo '<img src="reporting/fgraph.php?tipo=db_agente_modulo&width=600&height=200"><br />';
|
||||
if ($config['flash_charts']) {
|
||||
echo graph_db_agentes_modulos ($width, $height);
|
||||
} else {
|
||||
echo '<img src="include/fgraph.php?tipo=db_agente_modulo&width=600&height=200"><br />';
|
||||
}
|
||||
echo '</td></tr><tr><td><br /></tr></td>';
|
||||
echo '<tr><td>';
|
||||
echo '<h3>'.__('Packets per agent').'</h3>';
|
||||
echo '<img src="reporting/fgraph.php?tipo=db_agente_paquetes&width=600&height=200"><br />';
|
||||
if ($config['flash_charts']) {
|
||||
echo grafico_db_agentes_paquetes ($width, $height);
|
||||
} else {
|
||||
echo '<img src="include/fgraph.php?tipo=db_agente_paquetes&width=600&height=200"><br />';
|
||||
}
|
||||
echo '</table>';
|
||||
echo '<a href="#" onClick="toggleDiv(\'db_info_data\'); toggleDiv(\'db_info_graph\'); return false;">'.__('Press here to get database information as text').'</a></div>';
|
||||
echo '<div id="db_info_data" style="display:none">';
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
// Load global vars
|
||||
require_once ("include/config.php");
|
||||
if ($config['flash_charts']) {
|
||||
require_once ("include/fgraph.php");
|
||||
}
|
||||
|
||||
check_login ();
|
||||
|
||||
|
@ -44,8 +47,12 @@ echo '<h2>'.__('Database maintenance').' » '.__('Current database maintena
|
|||
<tr><td>
|
||||
<div align="justify">
|
||||
'.__('Please check your Pandora Server setup and be sure that database maintenance daemon is running. It\'s very important to keep up-to-date database to get the best performance and results in Pandora').'
|
||||
</div><br />
|
||||
<img src="reporting/fgraph.php?tipo=db_agente_purge&id=-1&height=250&width=490">
|
||||
</td></tr>
|
||||
</div><br />';
|
||||
if ($config['flash_charts']) {
|
||||
echo grafico_db_agentes_purge ($id_agente, $width, $height);
|
||||
} else {
|
||||
echo '<img src="include/fgraph.php?tipo=db_agente_purge&id=-1&height=250&width=490">';
|
||||
}
|
||||
echo '</td></tr>
|
||||
</table>';
|
||||
?>
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
|
||||
// Load global vars
|
||||
require("include/config.php");
|
||||
if ($config['flash_charts']) {
|
||||
require('include/fgraph.php');
|
||||
}
|
||||
|
||||
check_login ();
|
||||
|
||||
|
@ -30,10 +33,14 @@ if (! give_acl ($config['id_user'], 0, "DM")) {
|
|||
//id_agent = -1: None selected; id_agent = 0: All
|
||||
$id_agent = (int) get_parameter_post ("agent", -1);
|
||||
|
||||
echo '<h2>'.__('Database maintenance').' » '.__('Database purge').'</h2>
|
||||
<img src="reporting/fgraph.php?tipo=db_agente_purge&id='.$id_agent.'" />
|
||||
<br /><br />
|
||||
<h3>'.__('Get data from agent').'</h3>';
|
||||
echo '<h2>'.__('Database maintenance').' » '.__('Database purge').'</h2>';
|
||||
if ($config['flash_charts']) {
|
||||
echo grafico_db_agentes_purge ($id_agent, $width, $height);
|
||||
} else {
|
||||
echo '<img src="include/fgraph.php?tipo=db_agente_purge&id='.$id_agent.'" />';
|
||||
}
|
||||
echo '<br /><br />';
|
||||
echo '<h3>'.__('Get data from agent').'</h3>';
|
||||
|
||||
// All data (now)
|
||||
$time["all"] = get_system_time ();
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
// Login check
|
||||
require_once ("include/config.php");
|
||||
if ($config['flash_charts']) {
|
||||
require_once ('include/fgraph.php');
|
||||
}
|
||||
|
||||
check_login ();
|
||||
|
||||
|
@ -249,7 +252,12 @@ if (($render == 1) && (isset($modules))) {
|
|||
echo "<h3>".__('Combined image render')."</h3>";
|
||||
echo "<table class='databox'>";
|
||||
echo "<tr><td>";
|
||||
echo "<img src='reporting/fgraph.php?tipo=combined&id=$modules&weight_l=$weights&label=Combined%20Sample%20Graph&height=$height&width=$width&stacked=$stacked&period=$period' border=1 alt=''>";
|
||||
if ($config['flash_charts']) {
|
||||
echo graphic_combined_module (split (',', $modules), split (',', $weights), $period, $width, $height,
|
||||
'Combined%20Sample%20Graph', '', $events, 0, 0, $stacked);
|
||||
} else {
|
||||
echo "<img src='include/fgraph.php?tipo=combined&id=$modules&weight_l=$weights&label=Combined%20Sample%20Graph&height=$height&width=$width&stacked=$stacked&period=$period' border=1 alt=''>";
|
||||
}
|
||||
echo "</td></tr></table>";
|
||||
|
||||
}
|
||||
|
|
|
@ -114,6 +114,10 @@ $table->data[18][0] = __('Use agent access graph');
|
|||
$table->data[18][1] = __('Yes').' '.print_radio_button ('agentaccess', 1, '', $config["agentaccess"], true).' ';
|
||||
$table->data[18][1] .= __('No').' '.print_radio_button ('agentaccess', 0, '', $config["agentaccess"], true);
|
||||
|
||||
$table->data[19][0] = __('Flash charts');
|
||||
$table->data[19][1] = __('Yes').' '.print_radio_button ('flash_charts', 1, '', $config["flash_charts"], true).' ';
|
||||
$table->data[19][1] .= __('No').' '.print_radio_button ('flash_charts', 0, '', $config["flash_charts"], true);
|
||||
|
||||
echo '<form id="form_setup" method="post">';
|
||||
print_input_hidden ('update_config', 1);
|
||||
print_table ($table);
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,361 @@
|
|||
/**
|
||||
* FusionCharts: Flash Player detection and Chart embedding.
|
||||
* Version 1.2.3F ( 22 November 2008) - Specialized for FusionChartsFREE
|
||||
* Checking Flash Version >=6 and added updateChartXML() for FREE Charts.
|
||||
* Version: 1.2.3 (1st September, 2008) - Added Fix for % and & characters, scaled dimensions, fixes in to properly handling of double quotes and single quotes in setDataXML() function.
|
||||
* Version: 1.2.2 (10th July, 2008) - Added Fix for % scaled dimensions, fixes in setDataXML() and setDataURL() functions
|
||||
* Version: 1.2.1 (21st December, 2007) - Added setting up Transparent/opaque mode: setTransparent() function
|
||||
* Version: 1.2 (1st November, 2007) - Added FORM fixes for IE
|
||||
* Version: 1.1 (29th June, 2007) - Added Player detection, New conditional fixes for IE
|
||||
*
|
||||
* Morphed from SWFObject (http://blog.deconcept.com/swfobject/) under MIT License:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
*/
|
||||
if(typeof infosoftglobal == "undefined") var infosoftglobal = new Object();
|
||||
if(typeof infosoftglobal.FusionChartsUtil == "undefined") infosoftglobal.FusionChartsUtil = new Object();
|
||||
infosoftglobal.FusionCharts = function(swf, id, w, h, debugMode, registerWithJS, c, scaleMode, lang, detectFlashVersion, autoInstallRedirect){
|
||||
if (!document.getElementById) { return; }
|
||||
|
||||
//Flag to see whether data has been set initially
|
||||
this.initialDataSet = false;
|
||||
|
||||
//Create container objects
|
||||
this.params = new Object();
|
||||
this.variables = new Object();
|
||||
this.attributes = new Array();
|
||||
|
||||
//Set attributes for the SWF
|
||||
if(swf) { this.setAttribute('swf', swf); }
|
||||
if(id) { this.setAttribute('id', id); }
|
||||
|
||||
w=w.toString().replace(/\%$/,"%25");
|
||||
if(w) { this.setAttribute('width', w); }
|
||||
h=h.toString().replace(/\%$/,"%25");
|
||||
if(h) { this.setAttribute('height', h); }
|
||||
|
||||
|
||||
//Set background color
|
||||
if(c) { this.addParam('bgcolor', c); }
|
||||
|
||||
//Set Quality
|
||||
this.addParam('quality', 'high');
|
||||
|
||||
//Add scripting access parameter
|
||||
this.addParam('allowScriptAccess', 'always');
|
||||
|
||||
//Pass width and height to be appended as chartWidth and chartHeight
|
||||
this.addVariable('chartWidth', w);
|
||||
this.addVariable('chartHeight', h);
|
||||
|
||||
//Whether in debug mode
|
||||
debugMode = debugMode ? debugMode : 0;
|
||||
this.addVariable('debugMode', debugMode);
|
||||
//Pass DOM ID to Chart
|
||||
this.addVariable('DOMId', id);
|
||||
//Whether to registed with JavaScript
|
||||
registerWithJS = registerWithJS ? registerWithJS : 0;
|
||||
this.addVariable('registerWithJS', registerWithJS);
|
||||
|
||||
//Scale Mode of chart
|
||||
scaleMode = scaleMode ? scaleMode : 'noScale';
|
||||
this.addVariable('scaleMode', scaleMode);
|
||||
|
||||
//Application Message Language
|
||||
lang = lang ? lang : 'EN';
|
||||
this.addVariable('lang', lang);
|
||||
|
||||
//Whether to auto detect and re-direct to Flash Player installation
|
||||
this.detectFlashVersion = detectFlashVersion?detectFlashVersion:1;
|
||||
this.autoInstallRedirect = autoInstallRedirect?autoInstallRedirect:1;
|
||||
|
||||
//Ger Flash Player version
|
||||
this.installedVer = infosoftglobal.FusionChartsUtil.getPlayerVersion();
|
||||
|
||||
if (!window.opera && document.all && this.installedVer.major > 7) {
|
||||
// Only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
|
||||
infosoftglobal.FusionCharts.doPrepUnload = true;
|
||||
}
|
||||
}
|
||||
|
||||
infosoftglobal.FusionCharts.prototype = {
|
||||
setAttribute: function(name, value){
|
||||
this.attributes[name] = value;
|
||||
},
|
||||
getAttribute: function(name){
|
||||
return this.attributes[name];
|
||||
},
|
||||
addParam: function(name, value){
|
||||
this.params[name] = value;
|
||||
},
|
||||
getParams: function(){
|
||||
return this.params;
|
||||
},
|
||||
addVariable: function(name, value){
|
||||
this.variables[name] = value;
|
||||
},
|
||||
getVariable: function(name){
|
||||
return this.variables[name];
|
||||
},
|
||||
getVariables: function(){
|
||||
return this.variables;
|
||||
},
|
||||
getVariablePairs: function(){
|
||||
var variablePairs = new Array();
|
||||
var key;
|
||||
var variables = this.getVariables();
|
||||
for(key in variables){
|
||||
variablePairs.push(key +"="+ variables[key]);
|
||||
}
|
||||
return variablePairs;
|
||||
},
|
||||
getSWFHTML: function() {
|
||||
var swfNode = "";
|
||||
if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
|
||||
// netscape plugin architecture
|
||||
swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" ';
|
||||
swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
|
||||
var params = this.getParams();
|
||||
for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
|
||||
var pairs = this.getVariablePairs().join("&");
|
||||
if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
|
||||
swfNode += '/>';
|
||||
} else { // PC IE
|
||||
swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
|
||||
swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
|
||||
var params = this.getParams();
|
||||
for(var key in params) {
|
||||
swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
|
||||
}
|
||||
var pairs = this.getVariablePairs().join("&");
|
||||
if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
|
||||
swfNode += "</object>";
|
||||
}
|
||||
return swfNode;
|
||||
},
|
||||
setDataURL: function(strDataURL){
|
||||
//This method sets the data URL for the chart.
|
||||
//If being set initially
|
||||
if (this.initialDataSet==false){
|
||||
this.addVariable('dataURL',strDataURL);
|
||||
//Update flag
|
||||
this.initialDataSet = true;
|
||||
}else{
|
||||
//Else, we update the chart data using External Interface
|
||||
//Get reference to chart object
|
||||
var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id'));
|
||||
|
||||
if (!chartObj.setDataURL)
|
||||
{
|
||||
__flash__addCallback(chartObj, "setDataURL");
|
||||
}
|
||||
|
||||
chartObj.setDataURL(strDataURL);
|
||||
}
|
||||
},
|
||||
//This function :
|
||||
//fixes the double quoted attributes to single quotes
|
||||
//Encodes all quotes inside attribute values
|
||||
//Encodes % to %25 and & to %26;
|
||||
encodeDataXML: function(strDataXML){
|
||||
|
||||
var regExpReservedCharacters=["\\$","\\+"];
|
||||
var arrDQAtt=strDataXML.match(/=\s*\".*?\"/g);
|
||||
if (arrDQAtt){
|
||||
for(var i=0;i<arrDQAtt.length;i++){
|
||||
var repStr=arrDQAtt[i].replace(/^=\s*\"|\"$/g,"");
|
||||
repStr=repStr.replace(/\'/g,"%26apos;");
|
||||
var strTo=strDataXML.indexOf(arrDQAtt[i]);
|
||||
var repStrr="='"+repStr+"'";
|
||||
var strStart=strDataXML.substring(0,strTo);
|
||||
var strEnd=strDataXML.substring(strTo+arrDQAtt[i].length);
|
||||
var strDataXML=strStart+repStrr+strEnd;
|
||||
}
|
||||
}
|
||||
|
||||
strDataXML=strDataXML.replace(/\"/g,"%26quot;");
|
||||
strDataXML=strDataXML.replace(/%(?![\da-f]{2}|[\da-f]{4})/ig,"%25");
|
||||
strDataXML=strDataXML.replace(/\&/g,"%26");
|
||||
|
||||
return strDataXML;
|
||||
|
||||
},
|
||||
setDataXML: function(strDataXML){
|
||||
//If being set initially
|
||||
if (this.initialDataSet==false){
|
||||
//This method sets the data XML for the chart INITIALLY.
|
||||
this.addVariable('dataXML',this.encodeDataXML(strDataXML));
|
||||
//Update flag
|
||||
this.initialDataSet = true;
|
||||
}else{
|
||||
//Else, we update the chart data using External Interface
|
||||
//Get reference to chart object
|
||||
var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id'));
|
||||
chartObj.setDataXML(strDataXML);
|
||||
}
|
||||
},
|
||||
setTransparent: function(isTransparent){
|
||||
//Sets chart to transparent mode when isTransparent is true (default)
|
||||
//When no parameter is passed, we assume transparent to be true.
|
||||
if(typeof isTransparent=="undefined") {
|
||||
isTransparent=true;
|
||||
}
|
||||
//Set the property
|
||||
if(isTransparent)
|
||||
this.addParam('WMode', 'transparent');
|
||||
else
|
||||
this.addParam('WMode', 'Opaque');
|
||||
},
|
||||
|
||||
render: function(elementId){
|
||||
//First check for installed version of Flash Player - we need a minimum of 6
|
||||
if((this.detectFlashVersion==1) && (this.installedVer.major < 6)){
|
||||
if (this.autoInstallRedirect==1){
|
||||
//If we can auto redirect to install the player?
|
||||
var installationConfirm = window.confirm("You need Adobe Flash Player 6 (or above) to view the charts. It is a free and lightweight installation from Adobe.com. Please click on Ok to install the same.");
|
||||
if (installationConfirm){
|
||||
window.location = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
//Else, do not take an action. It means the developer has specified a message in the DIV (and probably a link).
|
||||
//So, expect the developers to provide a course of way to their end users.
|
||||
//window.alert("You need Adobe Flash Player 8 (or above) to view the charts. It is a free and lightweight installation from Adobe.com. ");
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
//Render the chart
|
||||
var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
|
||||
n.innerHTML = this.getSWFHTML();
|
||||
|
||||
//Added <FORM> compatibility
|
||||
//Check if it's added in Mozilla embed array or if already exits
|
||||
if(!document.embeds[this.getAttribute('id')] && !window[this.getAttribute('id')])
|
||||
window[this.getAttribute('id')]=document.getElementById(this.getAttribute('id'));
|
||||
//or else document.forms[formName/formIndex][chartId]
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---- detection functions ---- */
|
||||
infosoftglobal.FusionChartsUtil.getPlayerVersion = function(){
|
||||
var PlayerVersion = new infosoftglobal.PlayerVersion([0,0,0]);
|
||||
if(navigator.plugins && navigator.mimeTypes.length){
|
||||
var x = navigator.plugins["Shockwave Flash"];
|
||||
if(x && x.description) {
|
||||
PlayerVersion = new infosoftglobal.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
|
||||
}
|
||||
}else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){
|
||||
//If Windows CE
|
||||
var axo = 1;
|
||||
var counter = 3;
|
||||
while(axo) {
|
||||
try {
|
||||
counter++;
|
||||
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
|
||||
PlayerVersion = new infosoftglobal.PlayerVersion([counter,0,0]);
|
||||
} catch (e) {
|
||||
axo = null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Win IE (non mobile)
|
||||
// Do minor version lookup in IE, but avoid Flash Player 6 crashing issues
|
||||
try{
|
||||
var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
|
||||
}catch(e){
|
||||
try {
|
||||
var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
|
||||
PlayerVersion = new infosoftglobal.PlayerVersion([6,0,21]);
|
||||
axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
|
||||
} catch(e) {
|
||||
if (PlayerVersion.major == 6) {
|
||||
return PlayerVersion;
|
||||
}
|
||||
}
|
||||
try {
|
||||
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
|
||||
} catch(e) {}
|
||||
}
|
||||
if (axo != null) {
|
||||
PlayerVersion = new infosoftglobal.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
|
||||
}
|
||||
}
|
||||
return PlayerVersion;
|
||||
}
|
||||
infosoftglobal.PlayerVersion = function(arrVersion){
|
||||
this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
|
||||
this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
|
||||
this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
|
||||
}
|
||||
// ------------ Fix for Out of Memory Bug in IE in FP9 ---------------//
|
||||
/* Fix for video streaming bug */
|
||||
infosoftglobal.FusionChartsUtil.cleanupSWFs = function() {
|
||||
var objects = document.getElementsByTagName("OBJECT");
|
||||
for (var i = objects.length - 1; i >= 0; i--) {
|
||||
objects[i].style.display = 'none';
|
||||
for (var x in objects[i]) {
|
||||
if (typeof objects[i][x] == 'function') {
|
||||
objects[i][x] = function(){};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fixes bug in fp9
|
||||
if (infosoftglobal.FusionCharts.doPrepUnload) {
|
||||
if (!infosoftglobal.unloadSet) {
|
||||
infosoftglobal.FusionChartsUtil.prepUnload = function() {
|
||||
__flash_unloadHandler = function(){};
|
||||
__flash_savedUnloadHandler = function(){};
|
||||
window.attachEvent("onunload", infosoftglobal.FusionChartsUtil.cleanupSWFs);
|
||||
}
|
||||
window.attachEvent("onbeforeunload", infosoftglobal.FusionChartsUtil.prepUnload);
|
||||
infosoftglobal.unloadSet = true;
|
||||
}
|
||||
}
|
||||
/* Add document.getElementById if needed (mobile IE < 5) */
|
||||
if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }}
|
||||
/* Add Array.push if needed (ie5) */
|
||||
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}
|
||||
|
||||
/* Function to return Flash Object from ID */
|
||||
infosoftglobal.FusionChartsUtil.getChartObject = function(id)
|
||||
{
|
||||
var chartRef=null;
|
||||
if (navigator.appName.indexOf("Microsoft Internet")==-1) {
|
||||
if (document.embeds && document.embeds[id])
|
||||
chartRef = document.embeds[id];
|
||||
else
|
||||
chartRef = window.document[id];
|
||||
}
|
||||
else {
|
||||
chartRef = window[id];
|
||||
}
|
||||
if (!chartRef)
|
||||
chartRef = document.getElementById(id);
|
||||
|
||||
return chartRef;
|
||||
}
|
||||
/*
|
||||
Function to update chart's data at client side (FOR FusionCharts vFREE and 2.x
|
||||
*/
|
||||
infosoftglobal.FusionChartsUtil.updateChartXML = function(chartId, strXML){
|
||||
//Get reference to chart object
|
||||
var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(chartId);
|
||||
//Set dataURL to null
|
||||
chartObj.SetVariable("_root.dataURL","");
|
||||
//Set the flag
|
||||
chartObj.SetVariable("_root.isNewData","1");
|
||||
//Set the actual data
|
||||
chartObj.SetVariable("_root.newData",strXML);
|
||||
//Go to the required frame
|
||||
chartObj.TGotoLabel("/", "JavaScriptHandler");
|
||||
}
|
||||
|
||||
|
||||
/* Aliases for easy usage */
|
||||
var getChartFromId = infosoftglobal.FusionChartsUtil.getChartObject;
|
||||
var updateChartXML = infosoftglobal.FusionChartsUtil.updateChartXML;
|
||||
var FusionCharts = infosoftglobal.FusionCharts;
|
|
@ -0,0 +1,144 @@
|
|||
<?php
|
||||
// Page: FusionCharts.php
|
||||
// Author: InfoSoft Global (P) Ltd.
|
||||
// This page contains functions that can be used to render FusionCharts.
|
||||
|
||||
|
||||
// encodeDataURL function encodes the dataURL before it's served to FusionCharts.
|
||||
// If you've parameters in your dataURL, you necessarily need to encode it.
|
||||
// Param: $strDataURL - dataURL to be fed to chart
|
||||
// Param: $addNoCacheStr - Whether to add aditional string to URL to disable caching of data
|
||||
function encodeDataURL($strDataURL, $addNoCacheStr=false) {
|
||||
//Add the no-cache string if required
|
||||
if ($addNoCacheStr==true) {
|
||||
// We add ?FCCurrTime=xxyyzz
|
||||
// If the dataURL already contains a ?, we add &FCCurrTime=xxyyzz
|
||||
// We replace : with _, as FusionCharts cannot handle : in URLs
|
||||
if (strpos(strDataURL,"?")<>0)
|
||||
$strDataURL .= "&FCCurrTime=" . Date("H_i_s");
|
||||
else
|
||||
$strDataURL .= "?FCCurrTime=" . Date("H_i_s");
|
||||
}
|
||||
// URL Encode it
|
||||
return urlencode($strDataURL);
|
||||
}
|
||||
|
||||
|
||||
// datePart function converts MySQL database based on requested mask
|
||||
// Param: $mask - what part of the date to return "m' for month,"d" for day, and "y" for year
|
||||
// Param: $dateTimeStr - MySQL date/time format (yyyy-mm-dd HH:ii:ss)
|
||||
function datePart($mask, $dateTimeStr) {
|
||||
@list($datePt, $timePt) = explode(" ", $dateTimeStr);
|
||||
$arDatePt = explode("-", $datePt);
|
||||
$dataStr = "";
|
||||
// Ensure we have 3 parameters for the date
|
||||
if (count($arDatePt) == 3) {
|
||||
list($year, $month, $day) = $arDatePt;
|
||||
// determine the request
|
||||
switch ($mask) {
|
||||
case "m": return (int)$month;
|
||||
case "d": return (int)$day;
|
||||
case "y": return (int)$year;
|
||||
}
|
||||
// default to mm/dd/yyyy
|
||||
return (trim($month . "/" . $day . "/" . $year));
|
||||
}
|
||||
return $dataStr;
|
||||
}
|
||||
|
||||
|
||||
// renderChart renders the JavaScript + HTML code required to embed a chart.
|
||||
// This function assumes that you've already included the FusionCharts JavaScript class
|
||||
// in your page.
|
||||
|
||||
// $chartSWF - SWF File Name (and Path) of the chart which you intend to plot
|
||||
// $strURL - If you intend to use dataURL method for this chart, pass the URL as this parameter. Else, set it to "" (in case of dataXML method)
|
||||
// $strXML - If you intend to use dataXML method for this chart, pass the XML data as this parameter. Else, set it to "" (in case of dataURL method)
|
||||
// $chartId - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id.
|
||||
// $chartWidth - Intended width for the chart (in pixels)
|
||||
// $chartHeight - Intended height for the chart (in pixels)
|
||||
function renderChart($chartSWF, $strURL, $strXML, $chartId, $chartWidth, $chartHeight) {
|
||||
//First we create a new DIV for each chart. We specify the name of DIV as "chartId"Div.
|
||||
//DIV names are case-sensitive.
|
||||
|
||||
// The Steps in the script block below are:
|
||||
//
|
||||
// 1)In the DIV the text "Chart" is shown to users before the chart has started loading
|
||||
// (if there is a lag in relaying SWF from server). This text is also shown to users
|
||||
// who do not have Flash Player installed. You can configure it as per your needs.
|
||||
//
|
||||
// 2) The chart is rendered using FusionCharts Class. Each chart's instance (JavaScript) Id
|
||||
// is named as chart_"chartId".
|
||||
//
|
||||
// 3) Check whether we've to provide data using dataXML method or dataURL method
|
||||
// save the data for usage below
|
||||
if ($strXML=="")
|
||||
$tempData = "//Set the dataURL of the chart\n\t\tchart_$chartId.setDataURL(\"$strURL\")";
|
||||
else
|
||||
$tempData = "//Provide entire XML data using dataXML method\n\t\tchart_$chartId.setDataXML(\"$strXML\")";
|
||||
|
||||
// Set up necessary variables for the RENDERCAHRT
|
||||
$chartIdDiv = $chartId . "Div";
|
||||
|
||||
// create a string for outputting by the caller
|
||||
$render_chart = <<<RENDERCHART
|
||||
<!-- START Script Block for Chart $chartId -->
|
||||
<div id="$chartIdDiv" align="center">
|
||||
Chart.
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
//Instantiate the Chart
|
||||
var chart_$chartId = new FusionCharts("$chartSWF", "$chartId", "$chartWidth", "$chartHeight");
|
||||
$tempData
|
||||
//Finally, render the chart.
|
||||
chart_$chartId.render("$chartIdDiv");
|
||||
</script>
|
||||
<!-- END Script Block for Chart $chartId -->
|
||||
RENDERCHART;
|
||||
|
||||
return $render_chart;
|
||||
}
|
||||
|
||||
|
||||
//renderChartHTML function renders the HTML code for the JavaScript. This
|
||||
//method does NOT embed the chart using JavaScript class. Instead, it uses
|
||||
//direct HTML embedding. So, if you see the charts on IE 6 (or above), you'll
|
||||
//see the "Click to activate..." message on the chart.
|
||||
// $chartSWF - SWF File Name (and Path) of the chart which you intend to plot
|
||||
// $strURL - If you intend to use dataURL method for this chart, pass the URL as this parameter. Else, set it to "" (in case of dataXML method)
|
||||
// $strXML - If you intend to use dataXML method for this chart, pass the XML data as this parameter. Else, set it to "" (in case of dataURL method)
|
||||
// $chartId - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id.
|
||||
// $chartWidth - Intended width for the chart (in pixels)
|
||||
// $chartHeight - Intended height for the chart (in pixels)
|
||||
function renderChartHTML($chartSWF, $strURL, $strXML, $chartId, $chartWidth, $chartHeight) {
|
||||
// Generate the FlashVars string based on whether dataURL has been provided
|
||||
// or dataXML.
|
||||
$strFlashVars = "&chartWidth=" . $chartWidth . "&chartHeight=" . $chartHeight ;
|
||||
if ($strXML=="")
|
||||
// DataURL Mode
|
||||
$strFlashVars .= "&dataURL=" . $strURL;
|
||||
else
|
||||
//DataXML Mode
|
||||
$strFlashVars .= "&dataXML=" . $strXML;
|
||||
|
||||
$HTML_chart = <<<HTMLCHART
|
||||
<!-- START Code Block for Chart $chartId -->
|
||||
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="$chartWidth" height="$chartHeight" id="$chartId">
|
||||
<param name="allowScriptAccess" value="always" />
|
||||
<param name="movie" value="$chartSWF"/>
|
||||
<param name="FlashVars" value="$strFlashVars" />
|
||||
<param name="quality" value="high" />
|
||||
<embed src="$chartSWF" FlashVars="$strFlashVars" quality="high" width="$chartWidth" height="$chartHeight" name="$chartId" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
|
||||
</object>
|
||||
<!-- END Code Block for Chart $chartId -->
|
||||
HTMLCHART;
|
||||
|
||||
return $HTML_chart;
|
||||
}
|
||||
|
||||
// boolToNum function converts boolean values to numeric (1/0)
|
||||
function boolToNum($bVal) {
|
||||
return (($bVal==true) ? 1 : 0);
|
||||
}
|
||||
|
||||
?>
|
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 452 B After Width: | Height: | Size: 452 B |
Before Width: | Height: | Size: 437 B After Width: | Height: | Size: 437 B |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue