Merge pull request #23099 from colemanw/RecentItemAPI
[civicrm-core.git] / templates / CRM / Contact / Import / Form / DataSource.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | Copyright CiviCRM LLC. All rights reserved. |
4 | |
5 | This work is published under the GNU AGPLv3 license with some |
6 | permitted exceptions and without any warranty. For full license |
7 | and copyright information, see https://civicrm.org/licensing |
8 +--------------------------------------------------------------------+
9 *}
10
11 <div class="crm-block crm-form-block crm-import-datasource-form-block">
12 {if $showOnlyDataSourceFormPane}
13 {include file=$dataSourceFormTemplateFile}
14 {else}
15 {* Import Wizard - Step 1 (choose data source) *}
16 {* @var $form Contains the array for the form elements and other form associated information assigned to the template by the controller *}
17
18 {* WizardHeader.tpl provides visual display of steps thru the wizard as well as title for current step *}
19 {include file="CRM/common/WizardHeader.tpl"}
20 <div class="help">
21 {ts}The Import Wizard allows you to easily import contact records from other applications into CiviCRM. For example, if your organization has contacts in MS Access&reg; or Excel&reg;, and you want to start using CiviCRM to store these contacts, you can 'import' them here.{/ts} {help id='choose-data-source-intro'}
22 </div>
23 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
24 <div id="choose-data-source" class="form-item">
25 <h3>{ts}Choose Data Source{/ts}</h3>
26 <table class="form-layout">
27 <tr class="crm-import-datasource-form-block-dataSource">
28 <td class="label">{$form.dataSource.label}</td>
29 <td>{$form.dataSource.html} {help id='data-source-selection'}</td>
30 </tr>
31 </table>
32 </div>
33
34 {* Data source form pane is injected here when the data source is selected. *}
35 <div id="data-source-form-block">
36 {if $dataSourceFormTemplateFile}
37 {include file=$dataSourceFormTemplateFile}
38 {/if}
39 </div>
40
41 <div id="common-form-controls" class="form-item">
42 <h3>{ts}Import Options{/ts}</h3>
43 <table class="form-layout-compressed">
44 <tr class="crm-import-datasource-form-block-contactType">
45 <td class="label">{$form.contactType.label}</td>
46 <td>{$form.contactType.html} {help id='contact-type'}&nbsp;&nbsp;&nbsp;
47 <span id="contact-subtype">{$form.subType.label}&nbsp;&nbsp;&nbsp;{$form.subType.html} {help id='contact-sub-type'}</span></td>
48 </tr>
49 <tr class="crm-import-datasource-form-block-onDuplicate">
50 <td class="label">{$form.onDuplicate.label}</td>
51 <td>{$form.onDuplicate.html} {help id='dupes'}</td>
52 </tr>
53 <tr class="crm-import-datasource-form-block-dedupe">
54 <td class="label">{$form.dedupe.label}</td>
55 <td><span id="contact-dedupe">{$form.dedupe.html}</span> {help id='id-dedupe_rule'}</td>
56 </tr>
57 <tr class="crm-import-datasource-form-block-fieldSeparator">
58 <td class="label">{$form.fieldSeparator.label}</td>
59 <td>{$form.fieldSeparator.html} {help id='id-fieldSeparator'}</td>
60 </tr>
61 <tr>{include file="CRM/Core/Date.tpl"}</tr>
62 <tr>
63 <td></td><td class="description">{ts}Select the format that is used for date fields in your import data.{/ts}</td>
64 </tr>
65
66 {if $geoCode}
67 <tr class="crm-import-datasource-form-block-doGeocodeAddress">
68 <td class="label"></td>
69 <td>{$form.doGeocodeAddress.html} {$form.doGeocodeAddress.label}<br />
70 <span class="description">
71 {ts}This option is not recommended for large imports. Use the command-line geocoding script instead.{/ts}
72 </span>
73 {docURL page="user/initial-set-up/scheduled-jobs"}
74 </td>
75 </tr>
76 {/if}
77
78 {if $savedMapping}
79 <tr class="crm-import-datasource-form-block-savedMapping">
80 <td class="label"><label for="savedMapping">{$form.savedMapping.label}</label></td>
81 <td>{$form.savedMapping.html}<br />
82 &nbsp;&nbsp;&nbsp;<span class="description">{ts}Select Saved Mapping or Leave blank to create a new One.{/ts}</span></td>
83 </tr>
84 { /if}
85
86 {if $form.disableUSPS}
87 <tr class="crm-import-datasource-form-block-disableUSPS">
88 <td class="label"></td>
89 <td>{$form.disableUSPS.html} <label for="disableUSPS">{$form.disableUSPS.label}</label></td>
90 </tr>
91
92 {/if}
93 </table>
94 </div>
95
96 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"} </div>
97
98 {literal}
99 <script type="text/javascript">
100 CRM.$(function($) {
101 //build data source form block
102 buildDataSourceFormBlock();
103 buildSubTypes();
104 buildDedupeRules();
105 });
106
107 function buildDataSourceFormBlock(dataSource)
108 {
109 var dataUrl = {/literal}"{crmURL p=$urlPath h=0 q=$urlPathVar}"{literal};
110
111 if (!dataSource ) {
112 var dataSource = cj("#dataSource").val();
113 }
114
115 if ( dataSource ) {
116 dataUrl = dataUrl + '&dataSource=' + dataSource;
117 } else {
118 cj("#data-source-form-block").html( '' );
119 return;
120 }
121
122 cj("#data-source-form-block").load( dataUrl );
123 }
124
125 function buildSubTypes( )
126 {
127 element = cj('input[name="contactType"]:checked').val( );
128 var postUrl = {/literal}"{crmURL p='civicrm/ajax/subtype' h=0 }"{literal};
129 var param = 'parentId='+ element;
130 cj.ajax({ type: "POST", url: postUrl, data: param, async: false, dataType: 'json',
131
132 success: function(subtype){
133 if ( subtype.length == 0 ) {
134 cj("#subType").empty();
135 cj("#contact-subtype").hide();
136 } else {
137 cj("#contact-subtype").show();
138 cj("#subType").empty();
139
140 cj("#subType").append("<option value=''>- {/literal}{ts escape='js'}select{/ts}{literal} -</option>");
141 for ( var key in subtype ) {
142 // stick these new options in the subtype select
143 cj("#subType").append("<option value="+key+">"+subtype[key]+" </option>");
144 }
145 }
146
147
148 }
149 });
150
151 }
152
153 function buildDedupeRules( )
154 {
155 element = cj("input[name=contactType]:checked").val();
156 var postUrl = {/literal}"{crmURL p='civicrm/ajax/dedupeRules' h=0 }"{literal};
157 var param = 'parentId='+ element;
158 cj.ajax({ type: "POST", url: postUrl, data: param, async: false, dataType: 'json',
159
160 success: function(dedupe){
161 if ( dedupe.length == 0 ) {
162 cj("#dedupe").empty();
163 cj("#contact-dedupe").hide();
164 } else {
165 cj("#contact-dedupe").show();
166 cj("#dedupe").empty();
167
168 cj("#dedupe").append("<option value=''>- {/literal}{ts escape='js'}select{/ts}{literal} -</option>");
169 for ( var key in dedupe ) {
170 // stick these new options in the dedupe select
171 cj("#dedupe").append("<option value="+key+">"+dedupe[key]+" </option>");
172 }
173 }
174
175
176 }
177 });
178
179 }
180
181 </script>
182 {/literal}
183 {/if}
184 </div>