let whc_table = null;
let whc_list = null;
function whTable(list){
whc_list = list;
if(whc_list.length > 0){
let html_content = '';
let index = 0;
whc_list.forEach(function(installation){
let insturl = installation.hasOwnProperty('url') ? installation.url : 'http://' + installation.domain;
let dbinf = '';
if(installation.hasOwnProperty('db_result') && installation.db_result.result != 'success'){
let dbtitle = '{{langmod.ADDDBNOT}}: ' + handleDBError(installation.db_result.code);
dbinf = '' +
'' +
'' +
'';
}
html_content += '
' +
'' + installation.domain + ' ' +
'' + insturl + ' | ' +
'' + installation.path + ' | ' +
'' + installation.version + ' | ' +
'' + installation.lang + ' | ' +
'' +
'' +
' {{langmod.ADDSHORTDB}}: ' + installation.whcbd + ' {{langmod.ADDSHORTUDB}}: ' + installation.whcuserdb + ' ' +
dbinf +
' ' +
' | ' +
'' +
'' +
' | ' +
'
';
index++;
});
let table_html = '' +
'' +
'' +
'{{langmod.ADDDOMLAB}} | ' +
'{{langmod.ADDPATHLAB}} | ' +
'{{langmod.ADDVERLAB}} | ' +
'{{langmod.ADDLANGLAB}} | ' +
'{{langmod.ADDBDUDB}} | ' +
' | ' +
'
' +
'' +
'' +
html_content +
'' +
'
';
$('#table_whc_container').html(table_html);
$('.whc-table').DataTable().destroy();
whc_table = $('.whc-table').DataTable();
}else{
$('#table_whc_container').html('Thre\'s not WHCMS installations
');
}
$('[data-toggle="tooltip"]').tooltip();
}
function whInit(){
if(whc_list == null){
whReList();
}
}
function whReList(){
$('#table_whc_container').html(loader);
getList('whcms', function(response){
whTable(response);
});
}
function cancelWHC(idCollapse){
uchip.slideToggle('#whc_ist','#whc_form', function(){
});
$("#whccompname").val('');
$("#whccompemail").val('');
$("#whcadminemail").val('');
$('#whcdomain').val('');
$('#whcpach').val('whc');
$('#whcadminemail').val('');
$('#whcadminpass').val('');
$('#whcadminpass').pwstrength('forceUpdate');
$('#whcpassbd').val('');
$('#whcpassbd').pwstrength('forceUpdate');
$('#whcbd').val('whc{{mod.extra_data.randbd}}');
$('#whcuserdb').val('whc{{mod.extra_data.randbd}}');
uchip.validator('.reqwhc', true);
cancelGeneral(idCollapse);
}
function addWhcms(){
if(uchip.validator('.reqwhc')){
let psurl = $("#whcurl").val();
let psdomain = $("#whcdomain").val();
let pslang = $("#whclang").val();
let psbd = $("#whcbd").val();
let psuserdb = $("#whcuserdb").val();
let pspassbd = $("#whcpassbd").val();
let pspach = $("#whcpach").val();
let psadminemail = $("#whcadminemail").val();
let psadminpass = $("#whcadminpass").val();
let pscompanyemail = $("#whccompemail").val();
let pscompanyname = $("#whccompname").val();
let psfolderadmin= $("#whccompfolder").val();
let pslicense= $("#whclicense").val();
let dompath = $('#whcdomain option:selected').data('path');
let domssl = $('#whcdomain option:selected').data('ssl');
let data = 'whclang='+pslang+'&whcadminpass='+psadminpass+'&whcadminemail='+psadminemail+'&whclicense='+pslicense+'&whcfolderadmin='+psfolderadmin+'&whccompanyname='+pscompanyname+'&whccompanyemail='+pscompanyemail+'&whcurl=' + psurl + '&whcdomain=' + psdomain + '&whcbd=' + psbd + '&whcuserdb=' + psuserdb + '&whcpassbd=' + Base64.encode(pspassbd) +
'&whcpach=' + pspach + '&dompath=' + dompath + '&domssl=' + domssl;
let details = [
{
title : '{{langmod.ADDDOMLAB}}',
value : psdomain
},
{
title : '{{langmod.ADDURLLAB}}',
value : (domssl == 1 ? 'https' : 'http') + '://' + psdomain + '/' + pspach
},
{
title : '{{langmod.ADDPATHLAB}}',
value : dompath + '/' + pspach
},
{
title : '{{langmod.ADDDWP20}}',
value : psbd
},
{
title : '{{langmod.ADDDBUSERLAB}}',
value : psuserdb
}
];
confirmInstallation({
type: 'whcms',
script: 'WHCMS',
data : data,
wholepath: dompath + '/' + pspach,
callback: function(response){
if(response.hasOwnProperty('result') && response.result == 'success'){
if(response.db_result.result != 'success'){
noti_bubble('{{langmod.ADDINSTALLDET}} ' + handleDBError(response.db_result.code),'{{langmod.ADDATENTION}}!','warning',false,false,'6500',true);
}else{
noti_bubble('{{langmod.ADDINSTALLSUCC}}','{{langmod.SUCCESS}}','success',false,false,'3000',true);
}
}else{
noti_bubble('{{langmod.ADDERRORGEN}}','{{langmod.FERROR}}','error',false,false,'3000',true);
}
var variableHTML='';
if($("#instaled_whc").html()==undefined){
variableHTML+=''
$( "#accordion1" ).append( variableHTML );
$(".accordion-toggle").click(function(){
$("#"+$(this).prop('data-target')).slideToggle('slow');
});
}
$("#instaledEmpty").hide();
whTable(response.list);
cancelWHC('whc');
},
details: details
});
}else{
noti_bubble('{{langmod.ADDREQFIELDS}}','{{langmod.FERROR}}','error',false,false,'3000',true);
}
}