HOME


Mini Shell 1.0
DIR:/usr/local/cwpsrv/var/services/users/cwp_theme/original/js/modules/addons/
Upload File :
Current File : //usr/local/cwpsrv/var/services/users/cwp_theme/original/js/modules/addons/addons_smf.js.twig
let smf_table = null;
let smf_list = null;
function smfTable(list){
    smf_list = list;
    if(smf_list.length > 0){
        let html_content = '';
        let index = 0;
        smf_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 = '<span class="fa-stack fa-xs" title="' + dbtitle + '" data-toggle="tooltip" data-placement="top" aria-hidden="true">' +
                    '<i class="fa fa-circle fa-stack-2x"></i>' +
                    '<i class="fa fa-info fa-stack-1x fa-inverse"></i>' +
                    '</span>';
            }
            html_content += '<tr id="tdsmf_' + index + '">' +
                '<td>' + installation.domain + '<br>' +
                '<a href="' + insturl + '" target="_blank">' + insturl + '</a></td>' +
                '<td><div class="addon-td-item">' + installation.path + '</div></td>' +
                '<td><div class="addon-td-item">' + installation.version + '</div></td>' +
                '<td>' +
                '<div class="database-info-td">' +
                '<div><b>{{langmod.ADDSHORTDB}}: </b> ' + installation.smfbd + '<br><b>{{langmod.ADDSHORTUDB}}: </b>' + installation.smfuserdb + '</div>' +
                dbinf +
                '</div>' +
                '</td>' +
                '<td>' +
                '<div class="addon-td-item text-center"><button title="{{langmod.ADDDWP3}}" data-traddon="#tdsmf_' + index + '" data-type="smf" data-installation=\'' + JSON.stringify(installation) + '\' data-toggle="tooltip" data-placement="top" aria-hidden="true" class="btn btn-danger btn-xs btn-delete" onclick="return deleteAddon(this, 0)">' +
                '<i aria-hidden="true" class="fa fa-trash"></i>' +
                '</button></div>' +
                '</td>' +
                '</tr>';
            index++;
        });
        let table_html = '<table class="table table-striped smf-table">' +
            '<thead>' +
            '<tr>' +
            '<th>{{langmod.ADDDOMLAB}}</th>' +
            '<th>{{langmod.ADDPATHLAB}}</th>' +
            '<th>{{langmod.ADDVERLAB}}</th>' +
            '<th>{{langmod.ADDBDUDB}}</th>' +
            '<th class="text-center"></th>' +
            '</tr>' +
            '</thead>' +
            '<tbody id="trpaneljl">' +
            html_content +
            '</tbody>' +
            '</table>';
        $('#table_smf_container').html(table_html);
        $('.smf-table').DataTable().destroy();
        smf_table = $('.smf-table').DataTable();
    }else{
        $('#table_smf_container').html('<div class="empty_list"><h4 class="text-success">Thre\'s not smf installations</h4></div>');
    }
    $('[data-toggle="tooltip"]').tooltip();
}
function smfInit(){
    if(smf_list == null){
        smfReList();
    }
}
function smfReList(){
    $('#table_smf_container').html(loader);
    getList('smf', function(response){
        smfTable(response);
    });
}
function cancelsmf(idCollapse){
    uchip.slideToggle('#smf_ist','#smf_form', function(){

    });
    $("#smfcompname").val('');
    $("#smfcompemail").val('');
    $("#smfadminemail").val('');
    $('#smfdomain').val('');
    $('#smfpach').val('smf');
    $('#smfadminemail').val('');
    $('#smfadminpass').val('');
    $('#smfadminpass').pwstrength('forceUpdate');
    $('#smfpassbd').val('');
    $("#smfadminuser").val('');
    $('#smfpassbd').pwstrength('forceUpdate');
    $('#smfbd').val('smf{{mod.extra_data.randbd}}');
    $('#smfuserdb').val('smf{{mod.extra_data.randbd}}');

    uchip.validator('.reqsmf', true);
    cancelGeneral(idCollapse);
}
function addsmf(){
    if(uchip.validator('.reqsmf')){
        let psurl = $("#smfurl").val();
        let psdomain = $("#smfdomain").val();
        let pslang = $("#smflang").val();
        let psbd = $("#smfbd").val();
        let psuserdb = $("#smfuserdb").val();
        let pspassbd = $("#smfpassbd").val();
        let pspach = $("#smfpach").val();
        let psadminemail = $("#smfadminemail").val();
        let smfadminuser = $("#smfadminuser").val();
        let psadminpass = $("#smfadminpass").val();
        let pscompanyname = $("#smfcompname").val();
        let pslicense= $("#smflicense").val();
        let dompath =  $('#smfdomain option:selected').data('path');
        let domssl =  $('#smfdomain option:selected').data('ssl');
        let data = 'smfadminuser='+smfadminuser+'&smflang='+pslang+'&smfadminpass='+psadminpass+'&smfadminemail='+psadminemail+'&smfcompanyname='+pscompanyname+'&smfurl=' + psurl + '&smfdomain=' + psdomain + '&smfbd=' + psbd + '&smfuserdb=' + psuserdb + '&smfpassbd=' + Base64.encode(pspassbd) +
            '&smfpach=' + 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: 'smf',
            script: 'SMF',
            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_smf").html()==undefined){
                    variableHTML+='<div class="panel panel-default" id="instaled_smf">'+
                        ' <div class="panel-heading white-bg script-container-title">'+
                        '<a class="accordion-toggle" style="width: 100%" data-toggle="collapse"  aria-expanded="true" aria-controls="panel_smf_container" data-parent="#accordion1" data-target="#panel_smf_container">'+
                        '<h4 class="panel-title"><i class="more-less glyphicon-plus font-weight-bolder"></i></h4><h4 class="panel-title">SMF Installations</h4></a></div><div id="panel_smf_container"  class="panel-collapse collapse"><div class="panel-body" id="table_smf_container"><div class="table_cron_loader"><span><i class="fa fa-circle-o-notch fa-spin"></i></span></div></div></div></div>'
                    $( "#accordion1" ).append( variableHTML );
                    $(".accordion-toggle").click(function(){
                        $("#"+$(this).prop('data-target')).slideToggle('slow');
                    });
                }
                $("#instaledEmpty").hide();
                smfTable(response.list);
                cancelsmf('smf');
            },
            details: details
        });
    }else{
        noti_bubble('{{langmod.ADDREQFIELDS}}','{{langmod.FERROR}}','error',false,false,'3000',true);
    }
}