let mood_table = null; let mood_list = null; function moodTable(list){ mood_list = list; if(mood_list.length > 0){ let html_content = ''; let index = 0; mood_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.moodbd + '
{{langmod.ADDSHORTUDB}}: ' + installation.mooduserdb + '
' + dbinf + '
' + '' + '' + '
' + '' + ''; index++; }); let table_html = '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + html_content + '' + '
{{langmod.ADDDOMLAB}}{{langmod.ADDPATHLAB}}{{langmod.ADDVERLAB}}{{langmod.ADDBDUDB}}
'; $('#table_mood_container').html(table_html); $('.mood-table').DataTable().destroy(); mood_table = $('.mood-table').DataTable(); }else{ $('#table_mood_container').html('

Thre\'s not Moodle installations

'); } $('[data-toggle="tooltip"]').tooltip(); } function moodInit(){ if(mood_list == null){ moodReList(); } } function moodReList(){ $('#table_mood_container').html(loader); getList('moodle', function(response){ moodTable(response); }); } function cancelmood(idCollapse){ uchip.slideToggle('#mood_list','#mood_form', function(){ }); $('#mooddomain').val(''); $('#moodpach').val('mood'); $('#moodadminemail').val(''); $('#moodadminpass').val(''); $('#moodadminpass').pwstrength('forceUpdate'); $('#moodpassbd').val(''); $('#moodpassbd').pwstrength('forceUpdate'); $('#moodbd').val('mood{{mod.extra_data.randbd}}'); $('#mooduserdb').val('mood{{mod.extra_data.randbd}}'); uchip.validator('.reqmood', true); cancelGeneral(idCollapse); } function addmood(){ if(uchip.validator('.reqmood')){ let moodurl = $("#moodurl").val(); let mooddomain = $("#mooddomain").val(); let moodbd = $("#moodbd").val(); let mooduserdb = $("#mooduserdb").val(); let moodpassbd = $("#moodpassbd").val(); let moodpach = $("#moodpach").val(); let moodadminemail = $("#moodadminemail").val(); let mooddescription = $("#mooddescription").val(); let moodfirstname = $("#moodfirstname").val(); let moodlastname = $("#moodlastname").val(); let moodcompanyname = $("#moodcompname").val(); let moodadminpass = $("#moodadminpass").val(); let moodfolderadmin= $("#moodfolderadmin").val(); let moodadminuser= $("#moodadminuser").val(); let dompath = $('#mooddomain option:selected').data('path'); let domssl = $('#mooddomain option:selected').data('ssl'); let data = 'moodcompanyname='+moodcompanyname+'&moodlastname='+moodlastname+'&moodfirstname='+moodfirstname+'&mooddescription='+mooddescription+'&moodadminuser='+moodadminuser+'&moodfolderadmin='+moodfolderadmin+'&moodurl=' + moodurl + '&mooddomain=' + mooddomain + '&moodbd=' + moodbd + '&mooduserdb=' + mooduserdb + '&moodpassbd=' + Base64.encode(moodpassbd) + '&moodpach=' + moodpach + '&moodadminemail=' + moodadminemail + '&moodadminpass=' + Base64.encode(moodadminpass) + '&dompath=' + dompath + '&domssl=' + domssl; let details = [ { title : '{{langmod.ADDDOMLAB}}', value : mooddomain }, { title : '{{langmod.ADDURLLAB}}', value : (domssl == 1 ? 'http' : 'http') + '://' + mooddomain + '/' + moodpach }, { title : '{{langmod.ADDPATHLAB}}', value : dompath + '/' + moodpach }, { title : '{{langmod.ADDPS03}}', value : moodadminemail }, { title : '{{langmod.ADDDWP20}}', value : moodbd }, { title : '{{langmod.ADDDBUSERLAB}}', value : mooduserdb } ]; confirmInstallation({ type: 'moodle', script: 'Moodle', data : data, wholepath: dompath + '/' + moodpach, 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='mood'; if($("#instaled_"+modulin).html()==undefined){ variableHTML+='
'+ '
'+ ''+ '

' + '

Moodle Installations

' + '
' + '
' + '
' $( "#accordion1" ).append( variableHTML ); $(".accordion-toggle").click(function(){ $("#"+$(this).prop('data-target')).slideToggle('slow'); }); } $("#instaledEmpty").hide(); moodTable(response.list); cancelmood(); }, details: details }); }else{ noti_bubble('{{langmod.ADDREQFIELDS}}','{{langmod.FERROR}}','error',false,false,'3000',true); } }