let next_table = null;
let next_list = null;
function nextTable(list){
next_list = list;
if(next_list.length > 0){
let html_content = '';
let index = 0;
next_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 + ' | ' +
'' +
'' +
' {{langmod.ADDSHORTDB}}: ' + installation.nextbd + ' {{langmod.ADDSHORTUDB}}: ' + installation.nextuserdb + ' ' +
dbinf +
' ' +
' | ' +
'' +
'' +
' | ' +
'
';
index++;
});
let table_html = '' +
'' +
'' +
'{{langmod.ADDDOMLAB}} | ' +
'{{langmod.ADDPATHLAB}} | ' +
'{{langmod.ADDVERLAB}} | ' +
'{{langmod.ADDBDUDB}} | ' +
' | ' +
'
' +
'' +
'' +
html_content +
'' +
'
';
$('#table_next_container').html(table_html);
$('.next-table').DataTable().destroy();
next_table = $('.next-table').DataTable();
}else{
$('#table_next_container').html('Thre\'s not NextCloud installations
');
}
$('[data-toggle="tooltip"]').tooltip();
}
function nextInit(){
if(next_list == null){
nextReList();
}
}
function nextReList(){
$('#table_next_container').html(loader);
getList('next', function(response){
nextTable(response);
});
}
function cancelnext(idCollapse){
uchip.slideToggle('#next_list','#next_form', function(){
});
$('#nextdomain').val('');
$('#nextpach').val('next');
$('#nextpassbd').val('');
$('#nextpassbd').pwstrength('forceUpdate');
$('#nextbd').val('next{{mod.extra_data.randbd}}');
$('#nextuserdb').val('next{{mod.extra_data.randbd}}');
uchip.validator('.reqnext', true);
cancelGeneral(idCollapse);
}
function addNext(){
if(uchip.validator('.reqnext')){
let psurl = $("#nexturl").val();
let psdomain = $("#nextdomain").val();
let psbd = $("#nextbd").val();
let psuserdb = $("#nextuserdb").val();
let psuseradmin = $("#nextuseradmin").val();
let psuserpass = $("#nextuserpass").val();
let psuseremail = $("#nextuseremail").val();
let pspassbd = $("#nextpassbd").val();
let pspach = $("#nextpach").val();
let dompath = $('#nextdomain option:selected').data('path');
let domssl = $('#nextdomain option:selected').data('ssl');
let data = 'nextuseremail='+psuseremail+'&nextuserpass='+psuserpass+'&nextuseradmin='+psuseradmin+'&nexturl=' + psurl + '&nextdomain=' + psdomain + '&nextbd=' + psbd + '&nextuserdb=' + psuserdb + '&nextpassbd=' + pspassbd +
'&nextpach=' + 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: 'next',
script: 'NextCloud',
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='';
var modulin='next';
if($("#instaled_"+modulin).html()==undefined){
variableHTML+=''
$( "#accordion1" ).append( variableHTML );
$(".accordion-toggle").click(function(){
$("#"+$(this).prop('data-target')).slideToggle('slow');
});
}
$("#instaledEmpty").hide();
nextTable(response.list);
cancelnext('next');
},
details: details
});
}else{
noti_bubble('{{langmod.ADDREQFIELDS}}','{{langmod.FERROR}}','error',false,false,'3000',true);
}
}