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. |
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. |
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. |
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 +--------------------------------------------------------------------+
27 {* This template is used for adding/configuring Label Formats. *}
28 <div class="crm-block crm-form-block crm-labelFormat-form-block">
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
34 .{/ts} {ts}Do you want to continue?{/ts}
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}
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>
48 <tr class="crm-labelFormat-form-block-description">
49 <td class="right">{$form.description.label}</td>
50 <td colspan="3">{$form.description.html}</td>
52 <tr class="crm-labelFormat-form-block-is_default">
54 <td colspan="3">{$form.is_default.html} {$form.is_default.label}</td>
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>
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>
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>
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} {$form.bold.label} {$form.italic.html} {$form.italic.label}</td>
79 <td class="right">{$form.paper_dimensions.html}</td>
80 <td colspan="3" id="paper_dimensions"> </td>
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>
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>
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>
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>
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>
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
117 in selection lists. Enter a positive or negative integer. Lower numbers
119 are displayed ahead of higher numbers.{/ts}</span>
123 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
127 <script type="text/javascript">
130 var currentMetric = document.getElementById('metric').value;
131 selectPaper(document.getElementById('paper_size').value);
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();
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();
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));
166 document.getElementById('paper_dimensions').innerHTML = parseFloat(width) + ' ' + metric + ' x ' + parseFloat(height) + ' ' + metric;
167 currentMetric = metric;
170 function convertField(id, from, to) {
171 val = document.getElementById(id).value;
172 if (val == '' || isNaN(val)) {
175 val = convertMetric(val, from, to);
176 val = new String(val.toFixed(3));
177 document.getElementById(id).value = parseFloat(val);
180 function convertMetric(value, from, to) {
193 return value * 72 / 2.54;
199 return value * 72 / 25.4;
203 return value * 2.54 / 72;
205 return value * 25.4 / 72;