Change 'help' id to a class
[civicrm-core.git] / templates / CRM / Admin / Form / LabelFormats.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
2c4c49ca 3 | CiviCRM version 4.7 |
6a488035
TO
4 +--------------------------------------------------------------------+
5 | Copyright (C) 2011 Marty Wright |
6 | Licensed to CiviCRM under the Academic Free License version 3.0. |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26*}
27{* This template is used for adding/configuring Label Formats. *}
28<div class="crm-block crm-form-block crm-labelFormat-form-block">
2b221de0
KJ
29 {if $action eq 8}
30 <div class="messages status no-popup">
6a488035 31 <div class="icon inform-icon"></div>
d1401e86 32 {ts 1=$formatName}WARNING: You are about to delete the Label Format titled <strong>%1</strong>.{/ts} {ts}Do you want to continue?{/ts}
2b221de0
KJ
33 </div>
34 {elseif $action eq 16384}
35 <div class="messages status no-popup">
6a488035 36 <div class="icon inform-icon"></div>
d7bd49d2 37 {ts 1=$formatName}Are you sure you would like to make a copy of the Label Format titled <strong>%1</strong>?{/ts}
2b221de0
KJ
38 </div>
39 {else}
40 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
41 <table class="form-layout-compressed">
42 <tr class="crm-labelFormat-form-block-name">
43 <td class="right">{$form.label.label}</td>
44 <td colspan="3">{$form.label.html}</td>
45 </tr>
46 <tr class="crm-labelFormat-form-block-description">
47 <td class="right">{$form.description.label}</td>
48 <td colspan="3">{$form.description.html}</td>
49 </tr>
50 <tr class="crm-labelFormat-form-block-is_default">
51 <td>&nbsp;</td>
52 <td colspan="3">{$form.is_default.html}&nbsp;{$form.is_default.label}</td>
53 </tr>
f5cf8c8d 54 <!--tr class="crm-labelFormat-form-block-label_type">
2b221de0
KJ
55 <td class="right">{$form.label_type.label}</td>
56 <td colspan="3">{$form.label_type.html}</td>
f5cf8c8d 57 </tr-->
2b221de0
KJ
58 <tr>
59 <td class="right">{$form.paper_size.label}</td>
60 <td>{$form.paper_size.html}</td>
61 <td class="right">{$form.font_name.label}</td>
62 <td>{$form.font_name.html}</td>
63 </tr>
64 <tr>
65 <td class="right">{$form.orientation.label}</td>
66 <td>{$form.orientation.html}</td>
67 <td class="right">{$form.font_size.label}</td>
68 <td>{$form.font_size.html}</td>
69 </tr>
70 <tr>
71 <td class="right">{$form.metric.label}</td>
72 <td>{$form.metric.html}</td>
73 <td class="right">{$form.font_style.label}</td>
74 <td>{$form.bold.html}&nbsp;{$form.bold.label}&nbsp;&nbsp;{$form.italic.html}&nbsp;{$form.italic.label}</td>
75 </tr>
76 <tr>
77 <td class="right">{$form.paper_dimensions.html}</td>
78 <td colspan="3" id="paper_dimensions">&nbsp;</td>
79 </tr>
80 <tr>
81 <td class="right">{$form.NX.label}</td>
82 <td>{$form.NX.html}</td>
83 <td class="right">{$form.NY.label}</td>
84 <td>{$form.NY.html}</td>
85 </tr>
86 <tr>
87 <td class="right">{$form.lMargin.label}</td>
88 <td>{$form.lMargin.html}</td>
89 <td class="right">{$form.tMargin.label}</td>
90 <td>{$form.tMargin.html}</td>
91 </tr>
92 <tr>
93 <td class="right">{$form.width.label}</td>
94 <td>{$form.width.html}</td>
95 <td class="right">{$form.height.label}</td>
96 <td>{$form.height.html}</td>
97 </tr>
98 <tr>
99 <td class="right">{$form.SpaceX.label}</td>
100 <td>{$form.SpaceX.html}<br/><span class="description">{ts}Space between labels.{/ts}</span></td>
101 <td class="right">{$form.SpaceY.label}</td>
102 <td>{$form.SpaceY.html}<br/><span class="description">{ts}Space between labels.{/ts}</span></td>
103 </tr>
104 <tr>
105 <td class="right">{$form.lPadding.label}</td>
106 <td>{$form.lPadding.html}<br/><span class="description">{ts}Pad inside each label.{/ts}</span></td>
107 <td class="right">{$form.tPadding.label}</td>
108 <td>{$form.tPadding.html}<br/><span class="description">{ts}Pad inside each label.{/ts}</span></td>
109 </tr>
110 <tr class="crm-labelFormat-form-block-weight">
111 <td class="right">{$form.weight.label}</td>
d1401e86
ML
112 <td colspan="3">{$form.weight.html}
113 <div class="description">{ts}Weight controls the order in which Label Formats are displayed in selection lists. Enter a positive or negative integer. Lower numbers are displayed ahead of higher numbers.{/ts}</div>
2b221de0
KJ
114 </tr>
115 </table>
6a488035 116{literal}
2b221de0
KJ
117 <script type="text/javascript">
118 var currentWidth;
119 var currentHeight;
120 var currentMetric = document.getElementById('metric').value;
121 selectPaper(document.getElementById('paper_size').value);
6a488035 122
2b221de0
KJ
123 function selectPaper(val) {
124 dataUrl = {/literal}"{crmURL p='civicrm/ajax/paperSize' h=0 }"{literal};
125 cj.post(dataUrl, {paperSizeName: val}, function (data) {
126 cj("#paper_size").val(data.name);
6a488035 127 metric = document.getElementById('metric').value;
2b221de0
KJ
128 currentWidth = convertMetric(data.width, data.metric, metric);
129 currentHeight = convertMetric(data.height, data.metric, metric);
130 updatePaperDimensions();
131 }, 'json');
132 }
6a488035 133
2b221de0
KJ
134 function selectMetric(metric) {
135 convertField('tMargin', currentMetric, metric);
136 convertField('lMargin', currentMetric, metric);
137 convertField('width', currentMetric, metric);
138 convertField('height', currentMetric, metric);
139 convertField('SpaceX', currentMetric, metric);
140 convertField('SpaceY', currentMetric, metric);
141 convertField('lPadding', currentMetric, metric);
142 convertField('tPadding', currentMetric, metric);
143 currentWidth = convertMetric(currentWidth, currentMetric, metric);
144 currentHeight = convertMetric(currentHeight, currentMetric, metric);
145 updatePaperDimensions();
146 }
6a488035 147
2b221de0
KJ
148 function updatePaperDimensions() {
149 metric = document.getElementById('metric').value;
150 width = new String(currentWidth.toFixed(2));
151 height = new String(currentHeight.toFixed(2));
152 if (document.getElementById('orientation').value == 'landscape') {
153 width = new String(currentHeight.toFixed(2));
154 height = new String(currentWidth.toFixed(2));
155 }
156 document.getElementById('paper_dimensions').innerHTML = parseFloat(width) + ' ' + metric + ' x ' + parseFloat(height) + ' ' + metric;
157 currentMetric = metric;
6a488035 158 }
6a488035 159
2b221de0
KJ
160 function convertField(id, from, to) {
161 val = document.getElementById(id).value;
162 if (val == '' || isNaN(val)) {
163 return;
164 }
165 val = convertMetric(val, from, to);
166 val = new String(val.toFixed(3));
167 document.getElementById(id).value = parseFloat(val);
168 }
6a488035 169
2b221de0
KJ
170 function convertMetric(value, from, to) {
171 switch (from + to) {
172 case 'incm':
173 return value * 2.54;
174 case 'inmm':
175 return value * 25.4;
176 case 'inpt':
177 return value * 72;
178 case 'cmin':
179 return value / 2.54;
180 case 'cmmm':
181 return value * 10;
182 case 'cmpt':
183 return value * 72 / 2.54;
184 case 'mmin':
185 return value / 25.4;
186 case 'mmcm':
187 return value / 10;
188 case 'mmpt':
189 return value * 72 / 25.4;
190 case 'ptin':
191 return value / 72;
192 case 'ptcm':
193 return value * 2.54 / 72;
194 case 'ptmm':
195 return value * 25.4 / 72;
196 }
197 return value;
6a488035 198 }
6a488035 199
2b221de0 200 </script>
6a488035 201{/literal}
60158442
CW
202 {/if}
203 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
204</div>