Skip to content

Commit b0ed2f5

Browse files
committed
u20220309
1 parent 5fd5148 commit b0ed2f5

File tree

7 files changed

+203
-11
lines changed

7 files changed

+203
-11
lines changed

assets/css/style.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
#migration-page .form-group .form-label{width: 40%;float: left;text-align: right;padding-right: 20px;}
1111
#migration-page .form-group .form-field{width: 60%;float: left;}
1212
#migration-page .form-group .form-input{padding: 4px;display: block;border: 1px solid #ccc;width: 100%;border-radius: 2px;font-size: 16px;}
13+
#migration-page .form-group .form-action{float: right;text-align: right;margin-right: 5px;}
1314
#migration-page .width50{width: 50% !important;}
1415
#migration-page .width80{width: 80% !important;}
16+
#migration-page .width90{width: 90% !important;}
1517
#migration-page .icon-success-wrap{padding-left:30px;display: block;background: url("../img/icon-success.png") no-repeat bottom left;}
1618
#migration-page .icon-success{width:20px;height:20px;display: inline-block;background: url("../img/icon-success.png") no-repeat bottom left;vertical-align: middle;}
1719
#migration-page .icon-warning-wrap{padding-left:30px;display: block;background: url("../img/icon-warning.png") no-repeat bottom left;}
@@ -21,12 +23,14 @@
2123
#migration-page .alert-box.success {background:#e9ffd9 url('../img/icon-success.png') no-repeat 10px 50%;border:1px solid #a6ca8a;}
2224
#migration-page .alert-box.notice {background:#e3f7fc url('../img/icon-notice.png') no-repeat 10px 50%;border:1px solid #8ed9f6;}
2325
#migration-page .alert-box.error {background:#ffecec url('../img/icon-error.png') no-repeat 10px 50%;border:1px solid #f5aca6;}
24-
#migration-page label.message-valid{padding-left: 12px;background: url('../img/icon-arrow-up.gif') no-repeat top left; color: #ff0000;margin-top: 7px;}
26+
#migration-page label.message-valid, #migration-page label.message-item-valid{padding-left: 12px;background: url('../img/icon-arrow-up.gif') no-repeat top left; color: #ff0000;margin-top: 7px;}
2527
#migration-page .width50 label.message-valid{width: 200%;}
2628
#migration-page .btn-site{background: #4F44AE; color: #fff; border: none;}
2729
#migration-page .row-no-margin{margin-right: 0;margin-left: 0;}
2830
#migration-page .margin-center{margin: 0 auto !important;float: none;}
2931
#migration-page .top10{margin-top: 10px;}
32+
#migration-page .display-ib{display: inline-block !important;}
33+
#migration-page .cursor-pointer{cursor: pointer;}
3034

3135
/* TOOLTIP */
3236
#migration-page .tooltip-group {outline: none;cursor: help;text-decoration: none;position: relative;display: inline-block;text-align: left;vertical-align: middle;}
@@ -166,6 +170,7 @@
166170
#migration-page #upload-wrap .form-group .upload-note{clear: both; padding: 10px 0; border-top: 1px solid #e5e5e5;display: none;}
167171

168172
/* CONFIG CONTENT */
173+
#migration-page .cf-section-entity{margin-bottom: 15px;}
169174

170175
/*SELECT PLATFORM*/
171176
.platform-select2-container .select2-results__option{line-height: 30px;}

assets/js/jquery.extend.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
'use strict';
2929

3030
$.validator.addMethod( "url_internal", function( value, element ) {
31-
return this.optional( element ) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value );
31+
return this.optional( element ) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?(.*)?$/i.test( value );
3232
}, $.validator.messages.url );
3333

3434
}));

assets/js/jquery.migration.js

Lines changed: 192 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,17 @@
259259
function validateSelectDuplicate(elementId){
260260
var element = $(elementId);
261261
if(element.length < 0){
262-
return true;
262+
return false;
263263
}
264264
var check = new Array();
265265
$('select', element).each(function(index, value) {
266266
var elm_val = $(value).val();
267-
if(elm_val){
267+
var elm_opt = $(value).find(':selected');
268+
var duplicate = elm_opt.data('duplicate');
269+
if(duplicate == undefined || !duplicate){
270+
duplicate = 0;
271+
}
272+
if(elm_val && duplicate == 0){
268273
check[index] = elm_val;
269274
}
270275
});
@@ -283,6 +288,111 @@
283288
return result;
284289
}
285290

291+
function validateSelectsDuplicate(elementClass){
292+
var elements = $(elementClass);
293+
if(elements.length < 0){
294+
return false;
295+
}
296+
var resultAll = false;
297+
elements.each(function(i, v){
298+
var element = $(v);
299+
var check = new Array();
300+
$('select', element).each(function(index, value) {
301+
var elm_val = $(value).val();
302+
var elm_opt = $(value).find(':selected');
303+
var duplicate = elm_opt.data('duplicate');
304+
if(duplicate == undefined || !duplicate){
305+
duplicate = 0;
306+
}
307+
if(elm_val && duplicate == 0){
308+
check[index] = elm_val;
309+
}
310+
});
311+
var result = false;
312+
check.forEach(function(value, index) {
313+
check.forEach(function(value_tmp, index_tmp) {
314+
if (value_tmp === value && index !== index_tmp) {
315+
result = true;
316+
}
317+
});
318+
});
319+
if(result){
320+
$('.message-valid', element).html('Mapping value can\'t not be the same. Please change!').show();
321+
scrollToErrorMessage(element);
322+
resultAll = true;
323+
}
324+
});
325+
return resultAll;
326+
}
327+
328+
function validateCustomFieldMapType(){
329+
var elements = $('.cf-section-entity-map', container);
330+
if(elements.length < 0){
331+
return false;
332+
}
333+
var resultAll = false;
334+
elements.each(function(i, v){
335+
var element = $(v);
336+
var result = false;
337+
$('.form-group', element).each(function(i1, v1){
338+
var group = $(v1);
339+
var sf = group.find('.cf_source');
340+
var tf = group.find('.cf_target');
341+
if(!sf.length || !tf.length){
342+
return true;
343+
}
344+
var sfo = sf.find(':selected');
345+
var tfo = tf.find(':selected');
346+
var st = sfo.data('columnType');
347+
var tt = tfo.data('columnType');
348+
var sdt = sfo.data('detailType');
349+
var tdt = tfo.data('detailType');
350+
var check = (sdt == tdt);
351+
if(check){
352+
if(!st || !tt || st == tt){
353+
return true;
354+
}
355+
}
356+
check = isDbTypeMapRight(st, tt);
357+
if(!check){
358+
$('.message-item-valid', group).html('Mapping type must be the similar. Please change!').show();
359+
result = true;
360+
return false;
361+
}
362+
});
363+
if(result){
364+
scrollToElement(element);
365+
resultAll = true;
366+
}
367+
});
368+
return resultAll;
369+
}
370+
371+
function isDbTypeMapRight(source_type, target_type){
372+
if(source_type == target_type){
373+
return true;
374+
}
375+
var supports = {
376+
'int': ['tinyint', 'smallint', 'mediumint'],
377+
'bigint': ['int', 'tinyint', 'smallint', 'mediumint'],
378+
'double': ['float'],
379+
'decimal': ['double', 'float'],
380+
'datetime': ['date'],
381+
'varchar': ['int', 'tinyint', 'smallint', 'mediumint', 'bigint', 'double', 'float', 'decimal', 'date', 'datetime', 'timestamp', 'time', 'year', 'char'],
382+
'mediumtext': ['int', 'tinyint', 'smallint', 'mediumint', 'bigint', 'double', 'float', 'decimal', 'date', 'datetime', 'timestamp', 'time', 'year', 'char', 'varchar', 'tinytext'],
383+
'text': ['int', 'tinyint', 'smallint', 'mediumint', 'bigint', 'double', 'float', 'decimal', 'date', 'datetime', 'timestamp', 'time', 'year', 'char', 'varchar', 'tinytext', 'mediumtext'],
384+
'longtext': ['int', 'tinyint', 'smallint', 'mediumint', 'bigint', 'double', 'float', 'decimal', 'date', 'datetime', 'timestamp', 'time', 'year', 'char', 'varchar', 'tinytext', 'mediumtext', 'text'],
385+
'mediumblob': ['int', 'tinyint', 'smallint', 'mediumint', 'bigint', 'double', 'float', 'decimal', 'date', 'datetime', 'timestamp', 'time', 'year', 'char', 'varchar', 'tinytext', 'mediumtext', 'text', 'tinyblob'],
386+
'blob': ['int', 'tinyint', 'smallint', 'mediumint', 'bigint', 'double', 'float', 'decimal', 'date', 'datetime', 'timestamp', 'time', 'year', 'char', 'varchar', 'tinytext', 'mediumtext', 'text', 'tinyblob', 'mediumblob'],
387+
'longblob': ['int', 'tinyint', 'smallint', 'mediumint', 'bigint', 'double', 'float', 'decimal', 'date', 'datetime', 'timestamp', 'time', 'year', 'char', 'varchar', 'tinytext', 'mediumtext', 'text', 'tinyblob', 'mediumblob', 'blob']
388+
};
389+
if(supports[target_type] == undefined){
390+
return false;
391+
}
392+
var support = supports[target_type];
393+
return (support.indexOf(source_type) != -1);
394+
}
395+
286396
function validateCheckRequired(elementId){
287397
var element = $(elementId);
288398
if(element.length < 0){
@@ -298,12 +408,20 @@
298408

299409
function resetValidate(elementId){
300410
$('.message-valid', elementId).hide();
411+
$('.message-item-valid', elementId).hide();
301412
}
302413

303414
function scrollToErrorMessage(element){
415+
if(element.length < 1){
416+
return false;
417+
}
304418
$(window).scrollTop( $('.message-valid', element).offset().top - $(window).height() + 50);
305419
}
306420

421+
function scrollToElement(element){
422+
$(window).scrollTop(element.offset().top + 50);
423+
}
424+
307425
function createCookie(value) {
308426
var date = new Date();
309427
date.setTime(date.getTime() + (24 * 60 * 60 * 1000));
@@ -416,12 +534,12 @@
416534
if(result.next_type){
417535
processBarAnimate(result.next_type, false);
418536
}
419-
importEntity(result.next_type);
537+
delayImportEntity(result.next_type);
420538
} else if(response.status == 'process'){
421539
var result = response.data;
422540
processBarResult(result.type, result.total, result.import, result.error, result.point);
423541
processBarAnimate(result.type, false);
424-
importEntity(result.type);
542+
delayImportEntity(result.type);
425543
} else {
426544
processRetry(type);
427545
}
@@ -431,6 +549,19 @@
431549
});
432550
}
433551

552+
function delayImportEntity(type){
553+
importEntity(type);
554+
/*var time = parseFloat(settings.delay);
555+
if(time > 0){
556+
var delay = time * 1000;
557+
setTimeout(function(){
558+
importEntity(type);
559+
}, delay);
560+
} else {
561+
importEntity(type);
562+
}*/
563+
}
564+
434565
function processBarResult(entity, total, imported, error, point)
435566
{
436567
var id = '#import-wrap #' + entity + '-process';
@@ -510,6 +641,21 @@
510641
return result;
511642
}
512643

644+
function styleTable(element){
645+
var i = 0;
646+
$('.form-group', element).each(function(i, v){
647+
$(v).removeClass('even').removeClass('odd');
648+
var style_class = '';
649+
if(i%2){
650+
style_class = 'odd';
651+
} else {
652+
style_class = 'even';
653+
}
654+
$(v).addClass(style_class);
655+
i++;
656+
});
657+
}
658+
513659
function run(){
514660

515661
deleteCookie();
@@ -761,7 +907,9 @@
761907
if(!validateSelectRequired('#website-section')
762908
|| !validateSelectRequired('#language-section')
763909
|| validateSelectDuplicate('#language-section')
764-
|| !validateCheckRequired('#entity-section')){
910+
|| !validateCheckRequired('#entity-section')
911+
|| validateSelectsDuplicate('.cf-section-entity-map')
912+
|| validateCustomFieldMapType()){
765913
hideLoading();
766914
return false;
767915
}
@@ -783,6 +931,45 @@
783931
});
784932
});
785933

934+
$(container).on('click', '#cf-section .cf-add-field', function(){
935+
var _this = $(this);
936+
var cf_section = _this.closest('.cf-section-entity');
937+
var clone = $('.cf-clone', cf_section);
938+
var content_table = $('.mapping-table', cf_section);
939+
var html = $(clone.html());
940+
var index = cf_section.data('fieldIndex');
941+
var entity = cf_section.data('entity');
942+
html.find('.cf_source').attr('name', 'cf_source_' + entity + '[' + index + ']');
943+
html.find('.cf_target').attr('name', 'cf_target_' + entity + '[' + index + ']');
944+
content_table.append(html);
945+
index = index + 1;
946+
cf_section.data('fieldIndex', index);
947+
styleTable(content_table);
948+
$('select', html).select2({width: '100%'});
949+
});
950+
951+
$(container).on('click', '#cf-section .remove-field', function(){
952+
var _this = $(this);
953+
var form = _this.closest('.form-group');
954+
var cf_section = _this.closest('.cf-section-entity');
955+
form.remove();
956+
var content_table = $('.mapping-table', cf_section);
957+
styleTable(content_table);
958+
});
959+
960+
$(container).on('change', '#seo-plugin-select', function(){
961+
var _this = $(this);
962+
var seo_value = _this.val();
963+
if(!seo_value){
964+
return false;
965+
}
966+
var seoPlugin = seo_value.split('|##|');
967+
$(container).find('.seo-config-section').css({display: 'none'});
968+
seoPlugin.forEach(function(v, i){
969+
$(container).find('#' + v).css({display: 'block'});
970+
});
971+
});
972+
786973
$(container).on('click', '.toggle-element', function(){
787974
var _this = $(this);
788975
var check = _this.is(':checked');

d2ddatamigration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* DISCLAIMER
1212
* Do not edit or add to this file if you wish to upgrade this extension/plugin/module to newer version in the future.
1313
*
14-
* @author D2dSoft Developers <develop@d2d-soft.com>
14+
* @author D2dSoft Developers <developer@d2d-soft.com>
1515
* @copyright Copyright (c) 2021 D2dSoft (https://d2d-soft.com)
1616
* @license https://d2d-soft.com/license/AFL.txt
1717
*/

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* DISCLAIMER
1212
* Do not edit or add to this file if you wish to upgrade this extension/plugin/module to newer version in the future.
1313
*
14-
* @author D2dSoft Developers <develop@d2d-soft.com>
14+
* @author D2dSoft Developers <developer@d2d-soft.com>
1515
* @copyright Copyright (c) 2021 D2dSoft (https://d2d-soft.com)
1616
* @license https://d2d-soft.com/license/AFL.txt
1717
*/

translations/en.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* DISCLAIMER
1212
* Do not edit or add to this file if you wish to upgrade this extension/plugin/module to newer version in the future.
1313
*
14-
* @author D2dSoft Developers <develop@d2d-soft.com>
14+
* @author D2dSoft Developers <developer@d2d-soft.com>
1515
* @copyright Copyright (c) 2021 D2dSoft (https://d2d-soft.com)
1616
* @license https://d2d-soft.com/license/AFL.txt
1717
*/

translations/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* DISCLAIMER
1212
* Do not edit or add to this file if you wish to upgrade this extension/plugin/module to newer version in the future.
1313
*
14-
* @author D2dSoft Developers <develop@d2d-soft.com>
14+
* @author D2dSoft Developers <developer@d2d-soft.com>
1515
* @copyright Copyright (c) 2021 D2dSoft (https://d2d-soft.com)
1616
* @license https://d2d-soft.com/license/AFL.txt
1717
*/

0 commit comments

Comments
 (0)