From d6bc16d5836d5246a5874a7e4e5b3dee92dab0ff Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 3 Jun 2022 15:06:37 +1200 Subject: [PATCH] Extract common part of MapTable.tpl --- .../CRM/Contact/Import/Form/MapTable.tpl | 127 +++--------------- templates/CRM/Import/Form/MapTableCommon.tpl | 92 +++++++++++++ templates/CRM/common/highLightImport.tpl | 2 +- 3 files changed, 114 insertions(+), 107 deletions(-) create mode 100644 templates/CRM/Import/Form/MapTableCommon.tpl diff --git a/templates/CRM/Contact/Import/Form/MapTable.tpl b/templates/CRM/Contact/Import/Form/MapTable.tpl index e0fbce6125..b13969c0fd 100644 --- a/templates/CRM/Contact/Import/Form/MapTable.tpl +++ b/templates/CRM/Contact/Import/Form/MapTable.tpl @@ -7,111 +7,26 @@ | and copyright information, see https://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -
+{include file="CRM/Import/Form/MapTableCommon.tpl"} -{* Import Wizard - Data Mapping table used by MapFields.tpl and Preview.tpl *} -
- {strip} - - {if $savedMappingName} - - {/if} - - {* Header row - has column for column names if they have been supplied *} - - {if $columnNames} - - {/if} - {foreach from=$dataValues item=row key=index} - {math equation="x + y" x=$index y=1 assign="rowNumber"} - - {/foreach} - - - - {*Loop on columns parsed from the import data rows*} - {foreach from=$mapper key=i item=mapperField} - - {if array_key_exists($i, $columnNames)} - - {/if} - {foreach from=$dataValues item=row key=index} - - {/foreach} - - {* Display mapper - - {/foreach} -
{ts 1=$savedMappingName}Saved Field Mapping: %1{/ts}
{ts}Column Names{/ts}{ts 1=$rowNumber}Import Data (row %1){/ts}{ts}Matching CiviCRM Field{/ts}
{$columnNames[$i]}{$row[$i]|escape} - {if $wizard.currentStepName == 'Preview'} - {$mapperField} - {else} - {$mapperField.html|smarty:nodefaults} - {/if} -
- {/strip} - - {if $wizard.currentStepName != 'Preview'} -
- {if $savedMappingName} - {$form.updateMapping.html}    {$form.updateMapping.label} - {/if} - {$form.saveMapping.html}    {$form.saveMapping.label} -
- - - - - - - - - -
{$form.saveMappingName.label}{$form.saveMappingName.html}
{$form.saveMappingDesc.label}{$form.saveMappingDesc.html}
-
- {literal} - -
- {/if} -
-
+ }); + } + }); + + {/literal} +{/if} diff --git a/templates/CRM/Import/Form/MapTableCommon.tpl b/templates/CRM/Import/Form/MapTableCommon.tpl new file mode 100644 index 0000000000..83fa1fcc8e --- /dev/null +++ b/templates/CRM/Import/Form/MapTableCommon.tpl @@ -0,0 +1,92 @@ +
+ + {* Import Wizard - Data Mapping table used by MapFields.tpl and Preview.tpl *} +
+ {strip} + + {if $savedMappingName} + + {/if} + + {* Header row - has column for column names if they have been supplied *} + + {if $columnNames} + + {/if} + {foreach from=$dataValues item=row key=index} + {math equation="x + y" x=$index y=1 assign="rowNumber"} + + {/foreach} + + + + {*Loop on columns parsed from the import data rows*} + {foreach from=$mapper key=i item=mapperField} + + {if array_key_exists($i, $columnNames)} + + {/if} + {foreach from=$dataValues item=row key=index} + + {/foreach} + + {* Display mapper + + {/foreach} +
{ts 1=$savedMappingName}Saved Field Mapping: %1{/ts}
{ts}Column Names{/ts}{ts 1=$rowNumber}Import Data (row %1){/ts}{ts}Matching CiviCRM Field{/ts}
{$columnNames[$i]}{$row[$i]|escape} + {if $wizard.currentStepName == 'Preview'} + {$mapperField} + {else} + {$mapperField.html|smarty:nodefaults} + {/if} +
+ {/strip} + + {if $wizard.currentStepName != 'Preview'} +
+ {if $savedMappingName} + {$form.updateMapping.html}    {$form.updateMapping.label} + {/if} + {$form.saveMapping.html}    {$form.saveMapping.label} +
+ + + + + + + + + +
{$form.saveMappingName.label}{$form.saveMappingName.html}
{$form.saveMappingDesc.label}{$form.saveMappingDesc.html}
+
+ {literal} + +
+ {/if} + + +
+
diff --git a/templates/CRM/common/highLightImport.tpl b/templates/CRM/common/highLightImport.tpl index bd9156c941..6279ff532b 100644 --- a/templates/CRM/common/highLightImport.tpl +++ b/templates/CRM/common/highLightImport.tpl @@ -14,7 +14,7 @@ CRM.$(function($) { $.each(highlightedFields, function() { $('select[id^="mapper"][id$="_0"] option[value='+ this + ']').append(' *').css({"color":"#FF0000"}); }); - {/literal}{if $relationship}{literal} + {/literal}{if $highlightedRelFields}{literal} var highlightedRelFields = {/literal}{$highlightedRelFields|@json_encode}{literal}; function highlight() { var select, fields = highlightedRelFields[$(this).val()]; -- 2.25.1