3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
45 textarea { width: 20em }
49 <script type="text/javascript" src="{sugar_getjspath file='include/javascript/sugar_grp_yui_widgets.js'}"></script>
52 <form enctype="multipart/form-data" real_id="importstep3" id="importstep3" name="importstep3" method="POST" action="index.php">
53 <input type="hidden" name="module" value="Import">
54 <input type="hidden" name="custom_delimiter" value="{$CUSTOM_DELIMITER}">
55 <input type="hidden" name="custom_enclosure" value="{$CUSTOM_ENCLOSURE}">
56 <input type="hidden" name="import_type" value="{$TYPE}">
57 <input type="hidden" name="source" value="{$SOURCE}">
58 <input type="hidden" name="source_id" value="{$SOURCE_ID}">
59 <input type="hidden" name="action" value="Step3">
60 <input type="hidden" name="import_module" value="{$IMPORT_MODULE}">
61 <input type="hidden" name="to_pdf" value="1">
62 <input type="hidden" name="has_header" value="{$HAS_HEADER}">
63 <input type="hidden" name="tmp_file" value="{$TMP_FILE}">
64 <input type="hidden" name="tmp_file_base" value="{$TMP_FILE}">
65 <input type="hidden" name="firstrow" value="{$FIRSTROW}">
66 <input type="hidden" name="columncount" value ="{$COLUMNCOUNT}">
67 <input type="hidden" name="display_tabs_def">
70 <span class="required" align="right">{$APP.LBL_REQUIRED_SYMBOL}</span> {$APP.NTC_REQUIRED}
74 {$MOD.LBL_SELECT_FIELDS_TO_MAP}
77 <table border="0" cellpadding="0" width="100%" id="importTable" class="detail view">
78 {foreach from=$rows key=key item=item name=rows}
79 {if $smarty.foreach.rows.first}
81 <td style="text-align: left;" scope="row">
82 <b>{$MOD.LBL_DATABASE_FIELD}</b>
83 {sugar_help text=$MOD.LBL_DATABASE_FIELD_HELP}
85 {if $HAS_HEADER == 'on'}
86 <td style="text-align: left;" scope="row">
87 <b>{$MOD.LBL_HEADER_ROW}</b>
88 {sugar_help text=$MOD.LBL_HEADER_ROW_HELP}
91 <td style="text-align: left;" scope="row">
92 <b>{$MOD.LBL_DEFAULT_VALUE}</b>
93 {sugar_help text=$MOD.LBL_DEFAULT_VALUE_HELP}
95 <td style="text-align: left;" scope="row">
96 <b>{$MOD.LBL_ROW} 1</b>
97 {sugar_help text=$MOD.LBL_ROW_HELP}
99 {if $HAS_HEADER != 'on'}
100 <td style="text-align: left;"><b>{$MOD.LBL_ROW} 2</b></td>
105 <td valign="top" align="left" id="row_{$smarty.foreach.rows.index}_col_0">
106 <select class='fixedwidth' name="colnum_{$smarty.foreach.rows.index}">
107 <option value="-1">{$MOD.LBL_DONT_MAP}</option>
108 {$item.field_choices}
111 {if $HAS_HEADER == 'on'}
112 <td id="row_{$smarty.foreach.rows.index}_header">{$item.cell1}</td>
114 <td id="defaultvaluepicker_{$smarty.foreach.rows.index}" nowrap="nowrap">
115 {$item.default_field}
117 {if $item.show_remove}
119 <input title="{$MOD.LBL_REMOVE_ROW}" accessKey=""
120 id="deleterow_{$smarty.foreach.rows.index}" class="button" type="button"
121 value=" {$MOD.LBL_REMOVE_ROW} ">
124 {if $HAS_HEADER != 'on'}
125 <td id="row_{$smarty.foreach.rows.index}_col_1" scope="row">{$item.cell1}</td>
127 <td id="row_{$smarty.foreach.rows.index}_col_2" scope="row">{$item.cell2}</td>
132 <td align="left" colspan="4" style="background: transparent;">
133 <input title="{$MOD.LBL_ADD_ROW}" accessKey="" id="addrow" class="button" type="button"
134 name="button" value=" {$MOD.LBL_ADD_ROW} ">
135 <input title="{$MOD.LBL_SHOW_ADVANCED_OPTIONS}" accessKey="" id="toggleImportOptions" class="button" type="button"
136 name="button" value=" {$MOD.LBL_SHOW_ADVANCED_OPTIONS} ">
137
138 <span scope="row"><strong>{$MOD.LBL_SAVE_MAPPING_AS}</strong></span>
140 <input type="text" name="save_map_as" id="save_map_as" value=""
141 style="width: 20em" maxlength="254">
142 {sugar_help text=$MOD.LBL_SAVE_MAPPING_HELP}
146 <tr style="display: none;" id="importOptions">
147 <td valign="middle" colspan="4">
148 <table border="0" width="100%">
150 <td valign="top" width="50%">
152 <h4>{$MOD.LBL_IMPORT_FILE_SETTINGS} {sugar_help text=$MOD.LBL_IMPORT_FILE_SETTINGS_HELP}</h4>
153 <table border=0 class="edit view">
155 <td scope="row"><slot>{$MOD.LBL_CHARSET}</slot></td>
156 <td ><slot><select tabindex='4' name='importlocale_charset'>{$CHARSETOPTIONS}</select></slot></td>
159 <td scope="row"><slot>{$MOD.LBL_DATE_FORMAT}</slot></td>
160 <td ><slot><select tabindex='4' name='importlocale_dateformat'>{$DATEOPTIONS}</select></slot></td>
163 <td scope="row"><slot>{$MOD.LBL_TIME_FORMAT}</slot></td>
164 <td ><slot><select tabindex='4' name='importlocale_timeformat'>{$TIMEOPTIONS}</select></slot></td>
167 <td scope="row"><slot>{$MOD.LBL_TIMEZONE}</slot></td>
168 <td ><slot><select tabindex='4' name='importlocale_timezone'>{html_options options=$TIMEZONEOPTIONS selected=$TIMEZONE_CURRENT}</select></slot></td>
171 <td scope="row"><slot>{$MOD.LBL_CURRENCY}</slot></td>
173 <select tabindex='4' id='currency_select' name='importlocale_currency' onchange='setSymbolValue(this.selectedIndex);setSigDigits();'>{$CURRENCY}</select>
174 <input type="hidden" id="symbol" value="">
178 <td scope="row"><slot>
179 {$MOD.LBL_CURRENCY_SIG_DIGITS}:
182 <select id='sigDigits' onchange='setSigDigits(this.value);' name='importlocale_default_currency_significant_digits'>{$sigDigits}</select>
186 <td scope="row"><slot>
187 <i>{$MOD.LBL_LOCALE_EXAMPLE_NAME_FORMAT}</i>:
190 <input type="text" disabled id="sigDigitsExample" name="sigDigitsExample">
194 <td scope="row"><slot>{$MOD.LBL_NUMBER_GROUPING_SEP}</slot></td>
196 <input tabindex='4' name='importlocale_num_grp_sep' id='default_number_grouping_seperator'
197 type='text' maxlength='1' size='1' value='{$NUM_GRP_SEP}'
198 onkeydown='setSigDigits();' onkeyup='setSigDigits();'>
202 <td scope="row"><slot>{$MOD.LBL_DECIMAL_SEP}</slot></td>
204 <input tabindex='4' name='importlocale_dec_sep' id='default_decimal_seperator'
205 type='text' maxlength='1' size='1' value='{$DEC_SEP}'
206 onkeydown='setSigDigits();' onkeyup='setSigDigits();'>
210 <td scope="row" valign="top">{$MOD.LBL_LOCALE_DEFAULT_NAME_FORMAT}: </td>
212 <input onkeyup="setPreview();" onkeydown="setPreview();" id="default_locale_name_format" type="text" tabindex='4' name="importlocale_default_locale_name_format" value="{$default_locale_name_format}">
213 <br />{$MOD.LBL_LOCALE_NAME_FORMAT_DESC}
217 <td scope="row" valign="top"><i>{$MOD.LBL_LOCALE_EXAMPLE_NAME_FORMAT}:</i> </td>
218 <td valign="top"><input tabindex='4' id="nameTarget" name="no_value" id=":q" value="" style="border: none;" disabled size="50"></td>
223 <td valign="top" width="50%">
225 <h4>{$MOD.LBL_VERIFY_DUPS} {sugar_help text=$MOD.LBL_VERIFY_DUPLCATES_HELP}</h4>
234 {$JAVASCRIPT_CHOOSER}
236 {if $NOTETEXT != '' || $required_fields != ''}
238 <b>{$MOD.LBL_NOTES}</b>
240 <li>{$MOD.LBL_REQUIRED_NOTE}{$required_fields}</li>
247 <table width="100%" cellpadding="2" cellspacing="0" border="0">
250 <input title="{$MOD.LBL_BACK}" accessKey="" id="goback" class="button" type="submit" name="button" value=" {$MOD.LBL_BACK} ">
251 <input title="{$MOD.LBL_IMPORT_NOW}" accessKey="" id="importnow" class="button" type="button" name="button" value=" {$MOD.LBL_IMPORT_NOW} ">
258 <script type="text/javascript">
261 * Singleton to handle processing the import
263 ProcessImport = new function()
266 * number of file to process processed
271 * total files to processs
273 this.fileTotal = {/literal}{$FILECOUNT-1}{literal};
276 * total records to process
278 this.recordCount = {/literal}{$RECORDCOUNT}{literal};
281 * maximum number of records per file
283 this.recordThreshold = {/literal}{$RECORDTHRESHOLD}{literal};
288 this.submit = function()
290 document.getElementById("importstep3").tmp_file.value =
291 document.getElementById("importstep3").tmp_file_base.value + '-' + this.fileCount;
292 YAHOO.util.Connect.setForm(document.getElementById("importstep3"));
293 YAHOO.util.Connect.asyncRequest('POST', 'index.php',
295 success: function(o) {
296 if (o.responseText.replace(/^\s+|\s+$/g, '') != '') {
300 var locationStr = "index.php?module=Import"
302 + "&type={/literal}{$TYPE}{literal}"
303 + "&import_module={/literal}{$IMPORT_MODULE}{literal}";
304 if ( ProcessImport.fileCount >= ProcessImport.fileTotal ) {
305 YAHOO.SUGAR.MessageBox.updateProgress(1,'{/literal}{$MOD.LBL_IMPORT_COMPLETE}{literal}');
306 SUGAR.util.hrefURL(locationStr);
309 document.getElementById("importstep3").save_map_as.value = '';
310 ProcessImport.fileCount++;
311 ProcessImport.submit();
315 failure: function(o) {
316 YAHOO.SUGAR.MessageBox.minWidth = 500;
317 YAHOO.SUGAR.MessageBox.show({
319 title: '{/literal}{$MOD.LBL_IMPORT_ERROR}{literal}',
321 fn: function() { window.location.reload(true); }
327 if ( this.fileTotal > 0 ) {
328 move = this.fileCount/this.fileTotal;
330 YAHOO.SUGAR.MessageBox.updateProgress( move,
331 "{/literal}{$MOD.LBL_IMPORT_RECORDS}{literal} " + ((this.fileCount * this.recordThreshold) + 1)
332 + " {/literal}{$MOD.LBL_IMPORT_RECORDS_TO}{literal} " + Math.min(((this.fileCount+1) * this.recordThreshold),this.recordCount)
333 + " {/literal}{$MOD.LBL_IMPORT_RECORDS_OF}{literal} " + this.recordCount );
337 * begins the form submission process
339 this.begin = function()
341 datestarted = '{/literal}{$MOD.LBL_IMPORT_STARTED}{literal} ' +
342 YAHOO.util.Date.format('{/literal}{$datetimeformat}{literal}');
343 YAHOO.SUGAR.MessageBox.show({
344 title: '{/literal}{$STEP4_TITLE}{literal}',
359 <script type="text/javascript" language="Javascript">
361 {/literal}{$getNameJs}{literal}
362 {/literal}{$getNumberJs}{literal}
363 {/literal}{$currencySymbolJs}{literal}
364 setSymbolValue(document.getElementById('currency_select').selectedIndex);
367 {/literal}{$confirmReassignJs}{literal}