CRM-13327, do not expose name badge, option
[civicrm-core.git] / templates / CRM / Admin / Form / LabelFormats.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.4 |
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">
29 {if $action eq 8}
30 <div class="messages status no-popup">
31 <div class="icon inform-icon"></div>
32 {ts 1=$formatName}WARNING: You are about to delete the Label Format titled
33 <strong>%1</strong>
34 .{/ts} {ts}Do you want to continue?{/ts}
35 </div>
36 {elseif $action eq 16384}
37 <div class="messages status no-popup">
38 <div class="icon inform-icon"></div>
39 {ts 1=$formatName}Are you sure you would like to make a copy of the Label Format titled<strong>%1</strong>?{/ts}
40 </div>
41 {else}
42 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
43 <table class="form-layout-compressed">
44 <tr class="crm-labelFormat-form-block-name">
45 <td class="right">{$form.label.label}</td>
46 <td colspan="3">{$form.label.html}</td>
47 </tr>
48 <tr class="crm-labelFormat-form-block-description">
49 <td class="right">{$form.description.label}</td>
50 <td colspan="3">{$form.description.html}</td>
51 </tr>
52 <tr class="crm-labelFormat-form-block-is_default">
53 <td>&nbsp;</td>
54 <td colspan="3">{$form.is_default.html}&nbsp;{$form.is_default.label}</td>
55 </tr>
56 <!--tr class="crm-labelFormat-form-block-label_type">
57 <td class="right">{$form.label_type.label}</td>
58 <td colspan="3">{$form.label_type.html}</td>
59 </tr-->
60 <tr>
61 <td class="right">{$form.paper_size.label}</td>
62 <td>{$form.paper_size.html}</td>
63 <td class="right">{$form.font_name.label}</td>
64 <td>{$form.font_name.html}</td>
65 </tr>
66 <tr>
67 <td class="right">{$form.orientation.label}</td>
68 <td>{$form.orientation.html}</td>
69 <td class="right">{$form.font_size.label}</td>
70 <td>{$form.font_size.html}</td>
71 </tr>
72 <tr>
73 <td class="right">{$form.metric.label}</td>
74 <td>{$form.metric.html}</td>
75 <td class="right">{$form.font_style.label}</td>
76 <td>{$form.bold.html}&nbsp;{$form.bold.label}&nbsp;&nbsp;{$form.italic.html}&nbsp;{$form.italic.label}</td>
77 </tr>
78 <tr>
79 <td class="right">{$form.paper_dimensions.html}</td>
80 <td colspan="3" id="paper_dimensions">&nbsp;</td>
81 </tr>
82 <tr>
83 <td class="right">{$form.NX.label}</td>
84 <td>{$form.NX.html}</td>
85 <td class="right">{$form.NY.label}</td>
86 <td>{$form.NY.html}</td>
87 </tr>
88 <tr>
89 <td class="right">{$form.lMargin.label}</td>
90 <td>{$form.lMargin.html}</td>
91 <td class="right">{$form.tMargin.label}</td>
92 <td>{$form.tMargin.html}</td>
93 </tr>
94 <tr>
95 <td class="right">{$form.width.label}</td>
96 <td>{$form.width.html}</td>
97 <td class="right">{$form.height.label}</td>
98 <td>{$form.height.html}</td>
99 </tr>
100 <tr>
101 <td class="right">{$form.SpaceX.label}</td>
102 <td>{$form.SpaceX.html}<br/><span class="description">{ts}Space between labels.{/ts}</span></td>
103 <td class="right">{$form.SpaceY.label}</td>
104 <td>{$form.SpaceY.html}<br/><span class="description">{ts}Space between labels.{/ts}</span></td>
105 </tr>
106 <tr>
107 <td class="right">{$form.lPadding.label}</td>
108 <td>{$form.lPadding.html}<br/><span class="description">{ts}Pad inside each label.{/ts}</span></td>
109 <td class="right">{$form.tPadding.label}</td>
110 <td>{$form.tPadding.html}<br/><span class="description">{ts}Pad inside each label.{/ts}</span></td>
111 </tr>
112 <tr class="crm-labelFormat-form-block-weight">
113 <td class="right">{$form.weight.label}</td>
114 <td colspan="3">{$form.weight.html}<br/>
115 <span class="description">{ts}Weight controls the order in which Label Formats are displayed
116 <br/>
117 in selection lists. Enter a positive or negative integer. Lower numbers
118 <br/>
119 are displayed ahead of higher numbers.{/ts}</span>
120 </tr>
121 </table>
122 {/if}
123 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
124 </div>
125 {if $action neq 8}
126 {literal}
127 <script type="text/javascript">
128 var currentWidth;
129 var currentHeight;
130 var currentMetric = document.getElementById('metric').value;
131 selectPaper(document.getElementById('paper_size').value);
132
133 function selectPaper(val) {
134 dataUrl = {/literal}"{crmURL p='civicrm/ajax/paperSize' h=0 }"{literal};
135 cj.post(dataUrl, {paperSizeName: val}, function (data) {
136 cj("#paper_size").val(data.name);
137 metric = document.getElementById('metric').value;
138 currentWidth = convertMetric(data.width, data.metric, metric);
139 currentHeight = convertMetric(data.height, data.metric, metric);
140 updatePaperDimensions();
141 }, 'json');
142 }
143
144 function selectMetric(metric) {
145 convertField('tMargin', currentMetric, metric);
146 convertField('lMargin', currentMetric, metric);
147 convertField('width', currentMetric, metric);
148 convertField('height', currentMetric, metric);
149 convertField('SpaceX', currentMetric, metric);
150 convertField('SpaceY', currentMetric, metric);
151 convertField('lPadding', currentMetric, metric);
152 convertField('tPadding', currentMetric, metric);
153 currentWidth = convertMetric(currentWidth, currentMetric, metric);
154 currentHeight = convertMetric(currentHeight, currentMetric, metric);
155 updatePaperDimensions();
156 }
157
158 function updatePaperDimensions() {
159 metric = document.getElementById('metric').value;
160 width = new String(currentWidth.toFixed(2));
161 height = new String(currentHeight.toFixed(2));
162 if (document.getElementById('orientation').value == 'landscape') {
163 width = new String(currentHeight.toFixed(2));
164 height = new String(currentWidth.toFixed(2));
165 }
166 document.getElementById('paper_dimensions').innerHTML = parseFloat(width) + ' ' + metric + ' x ' + parseFloat(height) + ' ' + metric;
167 currentMetric = metric;
168 }
169
170 function convertField(id, from, to) {
171 val = document.getElementById(id).value;
172 if (val == '' || isNaN(val)) {
173 return;
174 }
175 val = convertMetric(val, from, to);
176 val = new String(val.toFixed(3));
177 document.getElementById(id).value = parseFloat(val);
178 }
179
180 function convertMetric(value, from, to) {
181 switch (from + to) {
182 case 'incm':
183 return value * 2.54;
184 case 'inmm':
185 return value * 25.4;
186 case 'inpt':
187 return value * 72;
188 case 'cmin':
189 return value / 2.54;
190 case 'cmmm':
191 return value * 10;
192 case 'cmpt':
193 return value * 72 / 2.54;
194 case 'mmin':
195 return value / 25.4;
196 case 'mmcm':
197 return value / 10;
198 case 'mmpt':
199 return value * 72 / 25.4;
200 case 'ptin':
201 return value / 72;
202 case 'ptcm':
203 return value * 2.54 / 72;
204 case 'ptmm':
205 return value * 25.4 / 72;
206 }
207 return value;
208 }
209
210 </script>
211 {/literal}
212 {/if}