| 1 | {* |
| 2 | +--------------------------------------------------------------------+ |
| 3 | | CiviCRM version 4.7 | |
| 4 | +--------------------------------------------------------------------+ |
| 5 | | Copyright CiviCRM LLC (c) 2004-2015 | |
| 6 | +--------------------------------------------------------------------+ |
| 7 | | This file is a part of CiviCRM. | |
| 8 | | | |
| 9 | | CiviCRM is free software; you can copy, modify, and distribute it | |
| 10 | | under the terms of the GNU Affero General Public License | |
| 11 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | |
| 12 | | | |
| 13 | | CiviCRM is distributed in the hope that it will be useful, but | |
| 14 | | WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| 16 | | See the GNU Affero General Public License for more details. | |
| 17 | | | |
| 18 | | You should have received a copy of the GNU Affero General Public | |
| 19 | | License and the CiviCRM Licensing Exception along | |
| 20 | | with this program; if not, contact CiviCRM LLC | |
| 21 | | at info[AT]civicrm[DOT]org. If you have questions about the | |
| 22 | | GNU Affero General Public License or the licensing of CiviCRM, | |
| 23 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | |
| 24 | +--------------------------------------------------------------------+ |
| 25 | *} |
| 26 | <div class="crm-block crm-form-block crm-import-maptable-form-block"> |
| 27 | |
| 28 | {* Import Wizard - Data Mapping table used by MapFields.tpl and Preview.tpl *} |
| 29 | <div id="map-field"> |
| 30 | {strip} |
| 31 | <table class="selector"> |
| 32 | {if $loadedMapping} |
| 33 | <tr class="columnheader-dark"><th colspan="4">{ts 1=$savedName}Saved Field Mapping: %1{/ts}</td></tr> |
| 34 | {/if} |
| 35 | <tr class="columnheader"> |
| 36 | {if $showColNames} |
| 37 | {assign var="totalRowsDisplay" value=$rowDisplayCount+1} |
| 38 | {else} |
| 39 | {assign var="totalRowsDisplay" value=$rowDisplayCount} |
| 40 | {/if} |
| 41 | {section name=rows loop=$totalRowsDisplay} |
| 42 | { if $smarty.section.rows.iteration == 1 and $showColNames} |
| 43 | <td>{ts}Column Names{/ts}</td> |
| 44 | {elseif $showColNames} |
| 45 | <td>{ts 1=$smarty.section.rows.iteration-1}Import Data (row %1){/ts}</td> |
| 46 | {else} |
| 47 | <td>{ts 1=$smarty.section.rows.iteration}Import Data (row %1){/ts}</td> |
| 48 | {/if} |
| 49 | {/section} |
| 50 | |
| 51 | <td>{ts}Matching CiviCRM Field{/ts}</td> |
| 52 | </tr> |
| 53 | |
| 54 | {*Loop on columns parsed from the import data rows*} |
| 55 | {section name=cols loop=$columnCount} |
| 56 | {assign var="i" value=$smarty.section.cols.index} |
| 57 | <tr style="border: 1px solid #DDDDDD;"> |
| 58 | |
| 59 | {if $showColNames} |
| 60 | <td class="even-row labels">{$columnNames[$i]}</td> |
| 61 | {/if} |
| 62 | |
| 63 | {section name=rows loop=$rowDisplayCount} |
| 64 | {assign var="j" value=$smarty.section.rows.index} |
| 65 | <td class="odd-row">{$dataValues[$j][$i]}</td> |
| 66 | {/section} |
| 67 | |
| 68 | {* Display mapper <select> field for 'Map Fields', and mapper value for 'Preview' *} |
| 69 | <td class="form-item even-row{if $wizard.currentStepName == 'Preview'} labels{/if}"> |
| 70 | {if $wizard.currentStepName == 'Preview'} |
| 71 | {if $relatedContactDetails && $relatedContactDetails[$i] != ''} |
| 72 | {$mapper[$i]} - {$relatedContactDetails[$i]} |
| 73 | |
| 74 | {if $relatedContactLocType && $relatedContactLocType[$i] != ''} |
| 75 | - {$relatedContactLocType[$i]} |
| 76 | {/if} |
| 77 | |
| 78 | {if $relatedContactPhoneType && $relatedContactPhoneType[$i] != ''} |
| 79 | - {$relatedContactPhoneType[$i]} |
| 80 | {/if} |
| 81 | |
| 82 | {* append IM Service Provider type for related contact *} |
| 83 | {if $relatedContactImProvider && $relatedContactImProvider[$i] != ''} |
| 84 | - {$relatedContactImProvider[$i]} |
| 85 | {/if} |
| 86 | |
| 87 | {* append website type *} |
| 88 | {if $relatedContactWebsiteType && $relatedContactWebsiteType[$i] != ''} |
| 89 | - {$relatedContactWebsiteType[$i]} |
| 90 | {/if} |
| 91 | |
| 92 | {else} |
| 93 | |
| 94 | {if $locations[$i]} |
| 95 | {$locations[$i]} - |
| 96 | {/if} |
| 97 | |
| 98 | {if $phones[$i]} |
| 99 | {$phones[$i]} - |
| 100 | {/if} |
| 101 | |
| 102 | {* append IM Service provider type for contact *} |
| 103 | {if $ims[$i]} |
| 104 | {$ims[$i]} - |
| 105 | {/if} |
| 106 | |
| 107 | {* append website type *} |
| 108 | {if $websites[$i]} |
| 109 | {$websites[$i]} - |
| 110 | {/if} |
| 111 | |
| 112 | {*else*} |
| 113 | {$mapper[$i]} |
| 114 | {*/if*} |
| 115 | {/if} |
| 116 | {else} |
| 117 | {$form.mapper[$i].html} |
| 118 | {/if} |
| 119 | </td> |
| 120 | |
| 121 | </tr> |
| 122 | {/section} |
| 123 | |
| 124 | </table> |
| 125 | {/strip} |
| 126 | |
| 127 | {if $wizard.currentStepName != 'Preview'} |
| 128 | <div> |
| 129 | |
| 130 | {if $loadedMapping} |
| 131 | <span>{$form.updateMapping.html} {$form.updateMapping.label}</span> |
| 132 | {/if} |
| 133 | <span>{$form.saveMapping.html} {$form.saveMapping.label}</span> |
| 134 | <div id="saveDetails" class="form-item"> |
| 135 | <table class="form-layout-compressed"> |
| 136 | <tr class="crm-import-maptable-form-block-saveMappingName"> |
| 137 | <td class="label">{$form.saveMappingName.label}</td> |
| 138 | <td>{$form.saveMappingName.html}</td> |
| 139 | </tr> |
| 140 | <tr class="crm-import-maptable-form-block-saveMappingName"> |
| 141 | <td class="label">{$form.saveMappingDesc.label}</td> |
| 142 | <td>{$form.saveMappingDesc.html}</td> |
| 143 | </tr> |
| 144 | </table> |
| 145 | </div> |
| 146 | <script type="text/javascript"> |
| 147 | {if $mappingDetailsError } |
| 148 | cj('#saveDetails').show(); |
| 149 | {else} |
| 150 | cj('#saveDetails').hide(); |
| 151 | {/if} |
| 152 | |
| 153 | {literal} |
| 154 | function showSaveDetails(chkbox) { |
| 155 | if (chkbox.checked) { |
| 156 | document.getElementById("saveDetails").style.display = "block"; |
| 157 | document.getElementById("saveMappingName").disabled = false; |
| 158 | document.getElementById("saveMappingDesc").disabled = false; |
| 159 | } else { |
| 160 | document.getElementById("saveDetails").style.display = "none"; |
| 161 | document.getElementById("saveMappingName").disabled = true; |
| 162 | document.getElementById("saveMappingDesc").disabled = true; |
| 163 | } |
| 164 | } |
| 165 | cj('select[id^="mapper"][id$="[0]"]').addClass('huge'); |
| 166 | {/literal} |
| 167 | {include file="CRM/common/highLightImport.tpl" relationship=true} |
| 168 | |
| 169 | {* // Set default location type *} |
| 170 | {literal} |
| 171 | CRM.$(function($) { |
| 172 | var defaultLocationType = "{/literal}{$defaultLocationType}{literal}"; |
| 173 | if (defaultLocationType.length) { |
| 174 | $('#map-field').on('change', 'select[id^="mapper"][id$="_0"]', function() { |
| 175 | var select = $(this).next(); |
| 176 | $('option', select).each(function() { |
| 177 | if ($(this).attr('value') == defaultLocationType |
| 178 | && $(this).text() == "{/literal}{$defaultLocationTypeLabel}{literal}") { |
| 179 | select.val(defaultLocationType); |
| 180 | } |
| 181 | }); |
| 182 | }); |
| 183 | } |
| 184 | }); |
| 185 | {/literal} |
| 186 | </script> |
| 187 | </div> |
| 188 | {/if} |
| 189 | </div> |
| 190 | </div> |