Fix JS for input buttons that are now button buttons
[civicrm-core.git] / templates / CRM / Report / Form / Layout / Graph.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | Copyright CiviCRM LLC. All rights reserved. |
4 | |
5 | This work is published under the GNU AGPLv3 license with some |
6 | permitted exceptions and without any warranty. For full license |
7 | and copyright information, see https://civicrm.org/licensing |
8 +--------------------------------------------------------------------+
9 *}
10 {assign var=uploadURL value=$config->imageUploadURL|replace:'/persist/contribute/':'/persist/'}
11 {* Display weekly,Quarterly,monthly and yearly contributions using pChart (Bar and Pie) *}
12 {if $chartEnabled and $chartSupported}
13 <div class='crm-chart'>
14 {if $outputMode eq 'print' OR $outputMode eq 'pdf'}
15 <img src="{$uploadURL|cat:$chartId}.png" />
16 {else}
17 <div id="chart_{$uniqueId}"></div>
18 {/if}
19 </div>
20 {/if}
21
22 {if !$printOnly} {* NO print section starts *}
23 {if !$section}
24 {include file="CRM/common/chart.tpl" divId="chart_$uniqueId"}
25 {/if}
26 {if $chartData}
27 {literal}
28 <script type="text/javascript">
29 CRM.$(function($) {
30 // Build all charts.
31 var allData = {/literal}{$chartData}{literal};
32
33 $.each( allData, function( chartID, chartValues ) {
34 var divName = {/literal}"chart_{$uniqueId}"{literal};
35 createChart( chartID, divName, chartValues.size.xSize, chartValues.size.ySize, allData[chartID].object );
36 });
37
38 // FIXME
39 $("input[id$='submit_print'],input[id$='submit_pdf']").bind('click', function(e){
40 // image creator php file path and append image name
41 var url = CRM.url('civicrm/report/chart', 'name=' + '{/literal}{$chartId}{literal}' + '.png');
42
43 //fetch object and 'POST' image
44 swfobject.getObjectById("chart_{/literal}{$uniqueId}{literal}").post_image(url, true, false);
45 });
46 });
47
48 </script>
49 {/literal}
50 {/if}
51 {/if}