console.log();
let joomlist = null;
let jltable = null;
function joomlaTable(list){
joomlist = list;
if(joomlist.length > 0){
let html_content = '';
let index = 0;
joomlist.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 + ' | ' +
'' +
'' +
' {{langmod.ADDSHORTDB}}: ' + installation.dbjl + ' {{langmod.ADDSHORTUDB}}: ' + installation.userbdjl + ' ' +
dbinf +
' ' +
' | ' +
'' +
' ' +
' ' +
' | ' +
'
';
index++;
});
let table_html = '' +
'' +
'' +
'{{langmod.ADDDOMLAB}} | ' +
'{{langmod.ADDPATHLAB}} | ' +
'{{langmod.ADDVERLAB}} | ' +
'{{langmod.ADDBDUDB}} | ' +
' | ' +
'
' +
'' +
'' +
html_content +
'' +
'
';
$('#table_jl_container').html(table_html);
$('.jl-table').DataTable().destroy();
jltable = $('.jl-table').DataTable();
}else{
$('#table_jl_container').html('{{langmod.ADDNOTJL}}
');
}
$('[data-toggle="tooltip"]').tooltip();
}
function cancelJl(idCollapse){
uchip.slideToggle('#jl_list','#jl_form', function(){
});
$('#jlpach').val('jl');
$('#jldomain').val('');
$('#jlbd').val('jl{{mod.extra_data.randbd}}');
$('#jluserdb').val('jl{{mod.extra_data.randbd}}');
$('#jlpassbd').val('');
$('#jlpassbd').pwstrength('forceUpdate');
uchip.validator('.reqjoomla', true);
cancelGeneral(idCollapse);
}
function jlInit(){
if(joomlist == null){
jlReList();
}
}
function jlReList(){
$('#table_jl_container').html(loader);
getList('joomla', function(response){
joomlaTable(response);
});
}
function addJoomla(){
if(uchip.validator('.reqjoomla')){
let jldomain = $('#jldomain').val();
let jlbd = $('#jlbd').val();
let jluserdb = $('#jluserdb').val();
let jlpassbd = $('#jlpassbd').val();
let jlpach = $('#jlpach').val();
let dompath = $('#jldomain option:selected').data('path');
let domssl = $('#jldomain option:selected').data('ssl');
let details = [
{
title : '{{langmod.ADDDOMLAB}}',
value : jldomain
},
{
title : '{{langmod.ADDURLLAB}}',
value : (domssl == 1 ? 'https' : 'http') + '://' + jldomain + '/' + jlpach
},
{
title : '{{langmod.ADDPATHLAB}}',
value : dompath + '/' + jlpach
},
{
title : '{{langmod.ADDDWP20}}',
value : jlbd
},
{
title : '{{langmod.ADDDBUSERLAB}}',
value : jluserdb
}
];
let data = 'domssl=' + domssl + '&domain=' + jldomain + '&database=' + jlbd + '&dbuser=' + jluserdb + '&dbpass=' + Base64.encode(jlpassbd) + '&path=' + jlpach + '&dompath=' + dompath;
confirmInstallation({
type: 'joomla',
script: 'Joomla',
data : data,
wholepath: dompath + '/' + jlpach,
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='';
var modulin='jl';
if($("#instaled_"+modulin).html()==undefined){
variableHTML+=''
$( "#accordion1" ).append( variableHTML );
$(".accordion-toggle").click(function(){
$("#"+$(this).prop('data-target')).slideToggle('slow');
});
}
$("#instaledEmpty").hide();
joomlaTable(response.list);
cancelJl('jl');
},
details: details
});
}else{
noti_bubble('{{langmod.ADDREQFIELDS}}','{{langmod.FERROR}}','error',false,false,'3000',true);
}
}