Merge pull request #14358 from samuelsov/billingblockts
[civicrm-core.git] / templates / CRM / common / openFlashChart.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2019 |
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 // HTML, HEAD, and BODY tags in JS literals obfuscated to avoid being parsed as DOM elements.
49 var html = 'html', head = 'head', body = 'body';
50 img_win.document.write('<' + html + '><' + head + '><title>Save Chart as Image<\/title><\/' + head + '><' + body + '>' + OFC.jquery.image(src) + ' <\/' + body + '><\/' + html + '>');
51 img_win.document.close();
52 }
53 }
54
55 function save_image( divName ) {
56 var divId = {/literal}"{$contriChart}"{literal} ? 'open_flash_chart_'+divName : {/literal}"{$divId}"{literal};
57 if( !divId ) {
58 divId = 'open_flash_'+divName;
59 }
60 OFC.jquery.popup( divId );
61 }
62
63 </script>
64 {/literal}