2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
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 <strong>%1</strong>.{/ts} {ts}Do you want to continue?{/ts}
34 {elseif $action eq 16384}
35 <div class="messages status no-popup">
36 <div class="icon inform-icon"></div>
37 {ts 1=$formatName}Are you sure you would like to make a copy of the Label Format titled<strong>%1</strong>?{/ts}
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>
46 <tr class="crm-labelFormat-form-block-description">
47 <td class="right">{$form.description.label}</td>
48 <td colspan="3">{$form.description.html}</td>
50 <tr class="crm-labelFormat-form-block-is_default">
52 <td colspan="3">{$form.is_default.html} {$form.is_default.label}</td>
54 <!--tr class="crm-labelFormat-form-block-label_type">
55 <td class="right">{$form.label_type.label}</td>
56 <td colspan="3">{$form.label_type.html}</td>
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>
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>
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} {$form.bold.label} {$form.italic.html} {$form.italic.label}</td>
77 <td class="right">{$form.paper_dimensions.html}</td>
78 <td colspan="3" id="paper_dimensions"> </td>
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>
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>
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>
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>
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>
110 <tr class="crm-labelFormat-form-block-weight">
111 <td class="right">{$form.weight.label}</td>
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>
117 <script type="text/javascript">
120 var currentMetric = document.getElementById('metric').value;
121 selectPaper(document.getElementById('paper_size').value);
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);
127 metric = document.getElementById('metric').value;
128 currentWidth = convertMetric(data.width, data.metric, metric);
129 currentHeight = convertMetric(data.height, data.metric, metric);
130 updatePaperDimensions();
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();
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));
156 document.getElementById('paper_dimensions').innerHTML = parseFloat(width) + ' ' + metric + ' x ' + parseFloat(height) + ' ' + metric;
157 currentMetric = metric;
160 function convertField(id, from, to) {
161 val = document.getElementById(id).value;
162 if (val == '' || isNaN(val)) {
165 val = convertMetric(val, from, to);
166 val = new String(val.toFixed(3));
167 document.getElementById(id).value = parseFloat(val);
170 function convertMetric(value, from, to) {
183 return value * 72 / 2.54;
189 return value * 72 / 25.4;
193 return value * 2.54 / 72;
195 return value * 25.4 / 72;
203 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>