| 1 | {* |
| 2 | +--------------------------------------------------------------------+ |
| 3 | | CiviCRM version 4.5 | |
| 4 | +--------------------------------------------------------------------+ |
| 5 | | Copyright CiviCRM LLC (c) 2004-2014 | |
| 6 | +--------------------------------------------------------------------+ |
| 7 | | This file is a part of CiviCRM. | |
| 8 | | | |
| 9 | | CiviCRM is free software; you can copy, modify, and distribute it | |
| 10 | | under the terms of the GNU Affero General Public License | |
| 11 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | |
| 12 | | | |
| 13 | | CiviCRM is distributed in the hope that it will be useful, but | |
| 14 | | WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| 16 | | See the GNU Affero General Public License for more details. | |
| 17 | | | |
| 18 | | You should have received a copy of the GNU Affero General Public | |
| 19 | | License and the CiviCRM Licensing Exception along | |
| 20 | | with this program; if not, contact CiviCRM LLC | |
| 21 | | at info[AT]civicrm[DOT]org. If you have questions about the | |
| 22 | | GNU Affero General Public License or the licensing of CiviCRM, | |
| 23 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | |
| 24 | +--------------------------------------------------------------------+ |
| 25 | *} |
| 26 | <script type="text/javascript" src="{$config->resourceBase}packages/OpenFlashChart/js/json/openflashchart.packed.js"></script> |
| 27 | <script type="text/javascript" src="{$config->resourceBase}packages/OpenFlashChart/js/swfobject.js"></script> |
| 28 | {literal} |
| 29 | <script type="text/javascript"> |
| 30 | function createSWFObject( chartID, divName, xSize, ySize, loadDataFunction ) { |
| 31 | var flashFilePath = {/literal}"{$config->resourceBase}packages/OpenFlashChart/open-flash-chart.swf"{literal}; |
| 32 | |
| 33 | //create object. |
| 34 | swfobject.embedSWF( flashFilePath, divName, |
| 35 | xSize, ySize, "9.0.0", |
| 36 | "expressInstall.swf", |
| 37 | {"get-data":loadDataFunction, "id":chartID}, |
| 38 | null, |
| 39 | {"wmode": 'transparent'} |
| 40 | ); |
| 41 | } |
| 42 | OFC = {}; |
| 43 | OFC.jquery = { |
| 44 | name: "jQuery", |
| 45 | image: function(src) { return "<img src='data:image/png;base64," + $('#'+src)[0].get_img_binary() + "' />"}, |
| 46 | popup: function(src) { |
| 47 | var img_win = window.open('', 'Save Chart as Image'); |
| 48 | img_win.document.write('<html><head><title>Save Chart as Image<\/title><\/head><body>' + OFC.jquery.image(src) + ' <\/body><\/html>'); |
| 49 | img_win.document.close(); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | function save_image( divName ) { |
| 54 | var divId = {/literal}"{$contriChart}"{literal} ? 'open_flash_chart_'+divName : {/literal}"{$divId}"{literal}; |
| 55 | if( !divId ) { |
| 56 | divId = 'open_flash_'+divName; |
| 57 | } |
| 58 | OFC.jquery.popup( divId ); |
| 59 | } |
| 60 | |
| 61 | </script> |
| 62 | {/literal} |