From 2b221de0c22f5793462ffbb57ecc4190e45e83e3 Mon Sep 17 00:00:00 2001 From: Kurund Jalmi Date: Sat, 29 Jun 2013 16:08:41 +0530 Subject: [PATCH] more fixes for label configuration, added used for radio for mailing label and name badges CRM-12965 --- CRM/Admin/Form/LabelFormats.php | 16 +- templates/CRM/Admin/Form/LabelFormats.tpl | 295 ++++++++++++---------- 2 files changed, 183 insertions(+), 128 deletions(-) diff --git a/CRM/Admin/Form/LabelFormats.php b/CRM/Admin/Form/LabelFormats.php index f5152af074..33606cfb2a 100644 --- a/CRM/Admin/Form/LabelFormats.php +++ b/CRM/Admin/Form/LabelFormats.php @@ -87,6 +87,18 @@ class CRM_Admin_Form_LabelFormats extends CRM_Admin_Form { $this->add('text', 'label', ts('Name'), $attributes['label'] + $disabled, $required); $this->add('text', 'description', ts('Description'), array('size' => CRM_Utils_Type::HUGE)); $this->add('checkbox', 'is_default', ts('Is this Label Format the default?')); + + $options = array( + 'label_format' => ts('Mailing Label'), + 'name_badge' => ts('Name Badge'), + ); + + $labelType = $this->addRadio('label_type', ts('Used For'), $options, null, '  '); + + if ($this->_action != CRM_Core_Action::ADD) { + $labelType->freeze(); + } + $this->add('select', 'paper_size', ts('Sheet Size'), array( 0 => ts('- default -') @@ -156,6 +168,8 @@ class CRM_Admin_Form_LabelFormats extends CRM_Admin_Form { $defaults['italic'] = (stripos($defaults['font-style'], 'I') !== FALSE); unset($defaults['font-style']); } + + $defaults['label_type'] = $this->_group; return $defaults; } @@ -220,7 +234,7 @@ class CRM_Admin_Form_LabelFormats extends CRM_Admin_Form { $values['font-style'] = $style; $bao = new CRM_Core_BAO_LabelFormat(); - $bao->saveLabelFormat($values, $this->_id, $this->_group); + $bao->saveLabelFormat($values, $this->_id, $values['label_type']); $status = ts('Your new Label Format titled %1 has been saved.', array(1 => $values['label'])); if ($this->_action & CRM_Core_Action::UPDATE) { diff --git a/templates/CRM/Admin/Form/LabelFormats.tpl b/templates/CRM/Admin/Form/LabelFormats.tpl index 61b64f0970..561687e39f 100644 --- a/templates/CRM/Admin/Form/LabelFormats.tpl +++ b/templates/CRM/Admin/Form/LabelFormats.tpl @@ -26,146 +26,187 @@ *} {* This template is used for adding/configuring Label Formats. *}
-{if $action eq 8} -
+ {if $action eq 8} +
- {ts 1=$formatName}WARNING: You are about to delete the Label Format titled %1.{/ts} {ts}Do you want to continue?{/ts} -
-{elseif $action eq 16384} -
+ {ts 1=$formatName}WARNING: You are about to delete the Label Format titled + %1 + .{/ts} {ts}Do you want to continue?{/ts} +
+ {elseif $action eq 16384} +
- {ts 1=$formatName}Are you sure you would like to make a copy of the Label Format titled %1?{/ts} -
-{else} -
{include file="CRM/common/formButtons.tpl" location="top"}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{$form.label.label}{$form.label.html}
{$form.description.label}{$form.description.html}
 {$form.is_default.html} {$form.is_default.label}
{$form.paper_size.label}{$form.paper_size.html}{$form.font_name.label}{$form.font_name.html}
{$form.orientation.label}{$form.orientation.html}{$form.font_size.label}{$form.font_size.html}
{$form.metric.label}{$form.metric.html}{$form.font_style.label}{$form.bold.html} {$form.bold.label}  {$form.italic.html} {$form.italic.label}
{$form.paper_dimensions.html} 
{$form.NX.label}{$form.NX.html}{$form.NY.label}{$form.NY.html}
{$form.lMargin.label}{$form.lMargin.html}{$form.tMargin.label}{$form.tMargin.html}
{$form.width.label}{$form.width.html}{$form.height.label}{$form.height.html}
{$form.SpaceX.label}{$form.SpaceX.html}
{ts}Space between labels.{/ts}
{$form.SpaceY.label}{$form.SpaceY.html}
{ts}Space between labels.{/ts}
{$form.lPadding.label}{$form.lPadding.html}
{ts}Pad inside each label.{/ts}
{$form.tPadding.label}{$form.tPadding.html}
{ts}Pad inside each label.{/ts}
{$form.weight.label}{$form.weight.html}
- {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}
-
-{/if} -
{include file="CRM/common/formButtons.tpl" location="bottom"}
+ {ts 1=$formatName}Are you sure you would like to make a copy of the Label Format titled%1?{/ts} +
+ {else} +
{include file="CRM/common/formButtons.tpl" location="top"}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{$form.label.label}{$form.label.html}
{$form.description.label}{$form.description.html}
 {$form.is_default.html} {$form.is_default.label}
{$form.label_type.label}{$form.label_type.html}
{$form.paper_size.label}{$form.paper_size.html}{$form.font_name.label}{$form.font_name.html}
{$form.orientation.label}{$form.orientation.html}{$form.font_size.label}{$form.font_size.html}
{$form.metric.label}{$form.metric.html}{$form.font_style.label}{$form.bold.html} {$form.bold.label}  {$form.italic.html} {$form.italic.label}
{$form.paper_dimensions.html} 
{$form.NX.label}{$form.NX.html}{$form.NY.label}{$form.NY.html}
{$form.lMargin.label}{$form.lMargin.html}{$form.tMargin.label}{$form.tMargin.html}
{$form.width.label}{$form.width.html}{$form.height.label}{$form.height.html}
{$form.SpaceX.label}{$form.SpaceX.html}
{ts}Space between labels.{/ts}
{$form.SpaceY.label}{$form.SpaceY.html}
{ts}Space between labels.{/ts}
{$form.lPadding.label}{$form.lPadding.html}
{ts}Pad inside each label.{/ts}
{$form.tPadding.label}{$form.tPadding.html}
{ts}Pad inside each label.{/ts}
{$form.weight.label}{$form.weight.html}
+ {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}
+
+ {/if} +
{include file="CRM/common/formButtons.tpl" location="bottom"}
{if $action neq 8} {literal} - + {/literal} {/if} \ No newline at end of file -- 2.25.1