Merge pull request #7728 from andrew-cormick-dockery/CRM-17959
[civicrm-core.git] / templates / CRM / Report / Form / Actions.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.7 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2016 |
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 {if !$printOnly} {* NO print section starts *}
27
28 {* build the print pdf buttons *}
29 <div class="crm-tasks">
30 {assign var=print value="_qf_"|cat:$form.formName|cat:"_submit_print"}
31 {assign var=pdf value="_qf_"|cat:$form.formName|cat:"_submit_pdf"}
32 {assign var=csv value="_qf_"|cat:$form.formName|cat:"_submit_csv"}
33 {assign var=group value="_qf_"|cat:$form.formName|cat:"_submit_group"}
34 {assign var=chart value="_qf_"|cat:$form.formName|cat:"_submit_chart"}
35 <table style="border:0;">
36 <tr>
37 <td>
38 <table class="form-layout-compressed">
39 <tr>
40 <td>{$form.$print.html}&nbsp;&nbsp;</td>
41 <td>{$form.$pdf.html}&nbsp;&nbsp;</td>
42 <td>{$form.$csv.html}&nbsp;&nbsp;</td>
43 {if $instanceUrl}
44 <td>&nbsp;&nbsp;&raquo;&nbsp;<a href="{$instanceUrl}">{ts}Existing report(s) from this template{/ts}</a></td>
45 {/if}
46 </tr>
47 </table>
48 </td>
49 <td>
50 <table class="form-layout-compressed" align="right">
51 {if $chartSupported}
52 <tr>
53 <td>{$form.charts.html|crmAddClass:big}</td>
54 <td align="right">{$form.$chart.html}</td>
55 </tr>
56 {/if}
57 {if $form.groups}
58 <tr>
59 <td>
60 {$form.groups.html}{$form.$group.html}
61 <script type="text/javascript">
62 {literal}
63 (function($) {
64 $('#groups').val('').change(function() {
65 CRM.confirm({
66 message: ts({/literal}'{ts escape='js' 1='<em>%1</em>'}Add all contacts to %1 group?{/ts}'{literal}, {1: $('option:selected', '#groups').text()})
67 })
68 .on({
69 'crmConfirm:yes': function() {
70 $('#groups').siblings(':submit').click();
71 },
72 'crmConfirm:no dialogclose': function() {
73 $('#groups').select2('val', '');
74 }
75 });
76 });
77 })(CRM.$);
78 {/literal}
79 </script>
80 </td>
81 </tr>
82 {/if}
83 </table>
84 </td>
85 </tr>
86 </table>
87 </div>
88
89 {literal}
90 <script type="text/javascript">
91 CRM.$(function($) {
92 // Disable print/pdf output of charts
93 $('select[name=charts]', 'form.crm-report-form').change(function() {
94 var viewType = $(this).val(),
95 flashChartType = '{/literal}{if $chartType}{$chartType}{else}{/if}{literal}';
96 $('#_qf_Summary_submit_pdf, #_qf_Summary_submit_print').prop('disabled', (viewType && flashChartType != viewType));
97 });
98 });
99 </script>
100 {/literal}
101 {/if} {* NO print section ends *}