From: avl Date: Thu, 16 Oct 2008 22:03:20 +0000 (+0300) Subject: Fusion Chart X-Git-Tag: 0.5~468 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=c961b0048847e774397d2fa2898212a151e46c8c;p=ipf.git Fusion Chart --- diff --git a/ipf.php b/ipf.php index 15a1692..eb62756 100644 --- a/ipf.php +++ b/ipf.php @@ -2,20 +2,20 @@ // Lazy ClassLoader function __autoload( $class_name ){ - $s = ''; + $s = ''; $a = explode( '_', $class_name ); - foreach( $a as &$folder ){ - if ( $s!='' ) - $s .= '/'; - $s .= strtolower( $folder ); + foreach( $a as &$folder ){ + if ( $s!='' ) + $s .= '/'; + $s .= strtolower( $folder ); } require_once($s.'.php'); } final class IPF{ - + private static $settings = array(); - + private static function applySettings($settings){ foreach($settings as $key=>$val){ IPF::$settings[strtolower($key)] = $val; @@ -25,7 +25,7 @@ final class IPF{ private static function loadSettings(){ $settings_file = IPF::$settings['project_path'].DIRECTORY_SEPARATOR.'settings.php'; IPF::$settings['settings_file'] = $settings_file; - + if (file_exists($settings_file)) IPF::applySettings(require $settings_file); else @@ -34,7 +34,7 @@ final class IPF{ $settings_local_file = IPF::$settings['project_path'].DIRECTORY_SEPARATOR.'settings_local.php'; if (file_exists($settings_local_file)) IPF::applySettings(require $settings_local_file); - + if (!isset(IPF::$settings['dsn'])) throw new IPF_Exception_Settings('Please specify DSN in settings file'); else @@ -58,7 +58,7 @@ final class IPF{ if (array_search('IPF_Admin',IPF::$settings['applications'])) IPF::$settings['template_dirs'][] = IPF::$settings['ipf_path'].DIRECTORY_SEPARATOR.'ipf'.DIRECTORY_SEPARATOR.'admin'.DIRECTORY_SEPARATOR.'templates'; } - + if (!isset(IPF::$settings['debug'])){ IPF::$settings['debug'] = false; } @@ -113,13 +113,13 @@ final class IPF{ private function __construct(){} private function __clone(){} - + public static function get($name,$default=null){ if (isset(IPF::$settings[$name])) return IPF::$settings[$name]; return $default; } - + public static function loadFunction($function) { if (function_exists($function)) { @@ -154,3 +154,5 @@ function __($str) $t = trim($str); return $t; } + + diff --git a/ipf/admin/media/chart/Area2D.swf b/ipf/admin/media/chart/Area2D.swf new file mode 100644 index 0000000..7d43169 Binary files /dev/null and b/ipf/admin/media/chart/Area2D.swf differ diff --git a/ipf/admin/media/chart/Bar2D.swf b/ipf/admin/media/chart/Bar2D.swf new file mode 100644 index 0000000..682320a Binary files /dev/null and b/ipf/admin/media/chart/Bar2D.swf differ diff --git a/ipf/admin/media/chart/Column2D.swf b/ipf/admin/media/chart/Column2D.swf new file mode 100644 index 0000000..f62480e Binary files /dev/null and b/ipf/admin/media/chart/Column2D.swf differ diff --git a/ipf/admin/media/chart/Column3D.swf b/ipf/admin/media/chart/Column3D.swf new file mode 100644 index 0000000..a8ee25c Binary files /dev/null and b/ipf/admin/media/chart/Column3D.swf differ diff --git a/ipf/admin/media/chart/Doughnut2D.swf b/ipf/admin/media/chart/Doughnut2D.swf new file mode 100644 index 0000000..6d86241 Binary files /dev/null and b/ipf/admin/media/chart/Doughnut2D.swf differ diff --git a/ipf/admin/media/chart/Doughnut3D.swf b/ipf/admin/media/chart/Doughnut3D.swf new file mode 100644 index 0000000..22ec4ef Binary files /dev/null and b/ipf/admin/media/chart/Doughnut3D.swf differ diff --git a/ipf/admin/media/chart/FusionCharts.js b/ipf/admin/media/chart/FusionCharts.js new file mode 100644 index 0000000..d6d9562 --- /dev/null +++ b/ipf/admin/media/chart/FusionCharts.js @@ -0,0 +1,342 @@ +/** + * FusionCharts: Flash Player detection and Chart embedding. + * Version: 1.2.3 (15th September, 2008) - Added fix for % and & characters. Additional fixes to properly handle 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); } + + debugMode = debugMode ? debugMode : 0; + this.addVariable('debugMode', debugMode); + + 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 + //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 = ' 0){ swfNode += 'flashvars="'+ pairs +'"'; } + swfNode += '/>'; + } else { // PC IE + swfNode = ''; + swfNode += ''; + var params = this.getParams(); + for(var key in params) { + swfNode += ''; + } + var pairs = this.getVariablePairs().join("&"); + if(pairs.length > 0) {swfNode += '';} + swfNode += ""; + } + 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 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; +} +/* Aliases for easy usage */ +var getChartFromId = infosoftglobal.FusionChartsUtil.getChartObject; +var FusionCharts = infosoftglobal.FusionCharts; \ No newline at end of file diff --git a/ipf/admin/media/chart/Line.swf b/ipf/admin/media/chart/Line.swf new file mode 100644 index 0000000..f6abe73 Binary files /dev/null and b/ipf/admin/media/chart/Line.swf differ diff --git a/ipf/admin/media/chart/MSArea.swf b/ipf/admin/media/chart/MSArea.swf new file mode 100644 index 0000000..2f9a52f Binary files /dev/null and b/ipf/admin/media/chart/MSArea.swf differ diff --git a/ipf/admin/media/chart/MSBar2D.swf b/ipf/admin/media/chart/MSBar2D.swf new file mode 100644 index 0000000..801ac0c Binary files /dev/null and b/ipf/admin/media/chart/MSBar2D.swf differ diff --git a/ipf/admin/media/chart/MSBar3D.swf b/ipf/admin/media/chart/MSBar3D.swf new file mode 100644 index 0000000..fc2b7e3 Binary files /dev/null and b/ipf/admin/media/chart/MSBar3D.swf differ diff --git a/ipf/admin/media/chart/MSColumn2D.swf b/ipf/admin/media/chart/MSColumn2D.swf new file mode 100644 index 0000000..501e081 Binary files /dev/null and b/ipf/admin/media/chart/MSColumn2D.swf differ diff --git a/ipf/admin/media/chart/MSColumn3D.swf b/ipf/admin/media/chart/MSColumn3D.swf new file mode 100644 index 0000000..f90d765 Binary files /dev/null and b/ipf/admin/media/chart/MSColumn3D.swf differ diff --git a/ipf/admin/media/chart/MSLine.swf b/ipf/admin/media/chart/MSLine.swf new file mode 100644 index 0000000..3551024 Binary files /dev/null and b/ipf/admin/media/chart/MSLine.swf differ diff --git a/ipf/admin/media/chart/Pie2D.swf b/ipf/admin/media/chart/Pie2D.swf new file mode 100644 index 0000000..e538a02 Binary files /dev/null and b/ipf/admin/media/chart/Pie2D.swf differ diff --git a/ipf/admin/media/chart/Pie3D.swf b/ipf/admin/media/chart/Pie3D.swf new file mode 100644 index 0000000..2667d6d Binary files /dev/null and b/ipf/admin/media/chart/Pie3D.swf differ diff --git a/ipf/admin/media/chart/SSGrid.swf b/ipf/admin/media/chart/SSGrid.swf new file mode 100644 index 0000000..8925679 Binary files /dev/null and b/ipf/admin/media/chart/SSGrid.swf differ diff --git a/ipf/admin/media/chart/StackedArea2D.swf b/ipf/admin/media/chart/StackedArea2D.swf new file mode 100644 index 0000000..e698780 Binary files /dev/null and b/ipf/admin/media/chart/StackedArea2D.swf differ diff --git a/ipf/admin/media/chart/StackedBar2D.swf b/ipf/admin/media/chart/StackedBar2D.swf new file mode 100644 index 0000000..59554d5 Binary files /dev/null and b/ipf/admin/media/chart/StackedBar2D.swf differ diff --git a/ipf/admin/media/chart/StackedBar3D.swf b/ipf/admin/media/chart/StackedBar3D.swf new file mode 100644 index 0000000..d456bf9 Binary files /dev/null and b/ipf/admin/media/chart/StackedBar3D.swf differ diff --git a/ipf/admin/media/chart/StackedColumn2D.swf b/ipf/admin/media/chart/StackedColumn2D.swf new file mode 100644 index 0000000..ce9efda Binary files /dev/null and b/ipf/admin/media/chart/StackedColumn2D.swf differ diff --git a/ipf/admin/media/chart/StackedColumn3D.swf b/ipf/admin/media/chart/StackedColumn3D.swf new file mode 100644 index 0000000..d818f7a Binary files /dev/null and b/ipf/admin/media/chart/StackedColumn3D.swf differ diff --git a/ipf/chart.php b/ipf/chart.php new file mode 100644 index 0000000..20304d0 --- /dev/null +++ b/ipf/chart.php @@ -0,0 +1,32 @@ +Chart\n". + ""; + return $render_chart; + } + + static function BoolToNum($bVal) { + return (($bVal==true) ? 1 : 0); + } +}