function deletepipe(st,email,dom){ if(st==0){ var strheader = '
'+email+'
'; var strfooter = ''; $("#deletemodalmail .modal-header").html(strheader); $("#deletemodalmail .modal-body").html(strbody); $("#deletemodalmail .modal-footer").html(strfooter); $("#deletemodalmail").modal('toggle'); return false; } if(st==1){ btnporcess('off','btnyesdel','{{ langmod.EMLABEL9 }}'); $.ajaxSetup({ headers: { 'csrftoken' : '{{ tokenajax }}' } }); $.ajax({ type: "POST", url: "./{{users}}/index.php?module=email_accounts&acc=pipe&op=del", data:"email="+email+"&domain="+dom, complete: function(datos){ refrespanelnew('email_forwarders'); $('#dataTables-pipe').DataTable().ajax.reload( function ( json ) { } ); btnporcess('off','btnyesdel','{{ langmod.EYES }}'); $("#deletemodalmail").modal('toggle'); noti_bubble('{{langmod.EMLPIPEDELETED}}','{{langmod.EMSUCCT}}','success',false,false,'3000',true); return false; } }); } return false; } function activepipeTwice(elem){ $('.table-loader-cwp').show(); let email = $(elem).data('emailaddress'); let active = $(elem).data('status'); $.ajax({ type: "POST", dataType: "json", url: "./{{users}}/index.php?module=email_accounts&acc=pipe&op=udp", data: "email=" + email+"&active="+active, complete: function (datos) { datos = datos.responseJSON; datos.response = (active == 1 ? 5 : 1); if(datos.hasOwnProperty('result') && datos.result == 'success'){ let action_type = '' if(datos.response == 5){ action_type = '{{langmod.EMLPIPEACTIVE}}'; }else{ action_type = '{{langmod.EMLPIPEDEACTIVE}}'; } switchEmailST(elem, datos.response); noti_bubble(action_type,'{{langmod.EMSUCCT}}','success',false,false,'3000',true); }else{ noti_bubble('An error occurred','Ups!','error',false,false,'3000',true); } $('.table-loader-cwp').hide(); return false; } }); } function activepipe(email,active){ $.ajaxSetup({ headers: { 'csrftoken' : '{{ tokenajax }}' } }); $.ajax({ type: "POST", url: "./{{users}}/index.php?module=email_accounts&acc=pipe&op=udp", data:"email="+email+"&active="+active, complete: function(datos){ //console.log(datos.responseText); $('#dataTables-pipe').DataTable().ajax.reload( function ( json ) { } ); noti_bubble('','{{langmod.EMLABEL16}}','success',false,false,'3000',true); return false; } }); } function updatelistemail(){ $.ajax({ type: "POST", url: "./{{users}}/index.php?module=email_accounts&acc=updatelistemail", complete: function (datos) { $("#contenttr").html(datos.responseText); return false; } }); return false; } function switchEmailST(elem, response){ let icon = $(elem).find('i'); $(elem).data('status', response); if(response == 5){ $(elem).removeClass('btn-success'); $(elem).addClass('btn-warning'); icon.removeClass('fa-thumbs-up'); icon.addClass('fa-thumbs-down'); }else{ $(elem).removeClass('btn-warning'); $(elem).addClass('btn-success'); icon.addClass('fa-thumbs-up'); icon.removeClass('fa-thumbs-down'); } } function emailactiveTwice(elem){ $('.table-loader-cwp').show(); let email = $(elem).data('emailaddress'); let st = $(elem).data('status'); $.ajax({ type: "POST", dataType: "json", url: "./{{users}}/index.php?module=email_accounts&acc=changestemail", data: "email=" + email+"&st="+st, complete: function (datos) { datos = datos.responseJSON; if(datos.hasOwnProperty('result') && datos.result == 'success'){ let action_type = '' if(datos.response == 5){ action_type = '{{langmod.EDESACTIVEEMAIL}}'; }else{ action_type = '{{langmod.EACTIVEEMAIL}}'; } switchEmailST(elem, datos.response); noti_bubble(action_type,'{{langmod.EMSUCCT}}','success',false,false,'3000',true); }else{ noti_bubble('An error occurred','Ups!','error',false,false,'3000',true); } $('.table-loader-cwp').hide(); return false; } }); } function emailactive(email,st){ $.ajax({ type: "POST", url: "./{{users}}/index.php?module=email_accounts&acc=changestemail", data: "email=" + email+"&st="+st, complete: function (datos) { $('#dataTables-examplemail').DataTable().ajax.reload( function ( json ) { } ); if(datos.responseText==5){ noti_bubble('{{langmod.EDESACTIVEEMAIL}}','{{langmod.EMSUCCT}}','success',false,false,'3000',true); } if(datos.responseText==1){ noti_bubble('{{langmod.EACTIVEEMAIL}}','{{langmod.EMSUCCT}}','success',false,false,'3000',true); } return false; } }); } function emaildelete(st,email,tr){ if(st==0){ var strheader = ''+email+'
'; var strfooter = ''; $("#deletemodalmail .modal-header").html(strheader); $("#deletemodalmail .modal-body").html(strbody); $("#deletemodalmail .modal-footer").html(strfooter); $("#deletemodalmail").modal('toggle'); return false; } if(st==1){ btnporcess('off','btnyesdel','{{ langmod.EMLABEL9 }}'); $.ajaxSetup({ headers: { 'csrftoken' : '{{ tokenajax }}' } }); $.ajax({ type: "POST", url: "./{{users}}/index.php?module=email_accounts&acc=emaildelete", data:"email="+email, complete: function(datos){ if(datos.responseText==1){ $('#dataTables-examplemail').DataTable().ajax.reload( function ( json ) { } ); noti_bubble('{{langmod.EMDELETEEMOK}}','{{langmod.EMSUCCT}}','success',false,false,'3000',true); refrespanelnew('email_accounts'); btnporcess('on','btnyesdel','{{ langmod.EYES }}'); $("#deletemodalmail").modal('hide'); return false; {#$.ajax({ type: "POST", url: "./{{users}}/index.php?module=email_accounts&acc=listemail", complete: function(datos){ //$('.dataTables-example').DataTable().destroy(); //$("#contftp").html(datos.responseText); //$('.dataTables-example').DataTable(); $('#dataTables-examplemail').DataTable().ajax.reload( function ( json ) { } ); noti_bubble('{{langmod.EMDELETEEMOK}}','{{langmod.EMSUCCT}}','success',false,false,'3000',true); refrespanelnew('email_accounts'); btnporcess('on','btnyesdel','{{ langmod.EYES }}'); $("#deletemodalmail").modal('hide'); return false; } });#} }else{ noti_bubble('{{langmod.EERROR2}}','{{langmod.EWARNING}}','error',false,false,'3000',true); btnporcess('on','btnyesdel','{{ langmod.EYES }}'); return false; } } }); return false; } return false; } function btncancelemail(){ $("#addmailmodal").modal('hide'); } function changerrandom(inputdiv, elem){ $(elem).hide(); $('.generator_loader').show(); var long=$("#lengthpass").val(); var typepass=$("#typepass").val(); $.ajaxSetup({ headers: { 'csrftoken' : '{{ tokenajax }}' } }); $.ajax({ type: "POST", url: "./{{users}}/index.php?module=email_accounts&acc=changerrandom&long="+long+"&typepass="+typepass, complete: function(datos){ $('.generator_loader').hide(); $(elem).show(); $("#"+inputdiv).val(datos.responseText); if(inputdiv == 'pass1email'){ $('#pass2email').val(datos.responseText); } copyPass(inputdiv); return false; } }); return false; } $('#modal-changepassemail').on('shown.bs.modal', function (e) { }); $(document).ready(function() { var options1 = {}; options1.ui = { container: "#changepass_container", showVerdictsInsideProgressBar: true, viewports: { progress: ".pwstrength_viewport_progress" } }; options1.common = { debug: false, }; $('#pass1email').pwstrength(options1); var table = $('#dataTables-examplefor').on( 'processing.dt', function ( e, settings, processing ) { $('#dataTables-examplefor_processing').css('display', 'none'); if (processing) { $(this).hide(); $('#tab-2 .table-loader-cwp').show(); } else { $('#tab-2 .table-loader-cwp').hide(); $(this).show(); } }).DataTable({ "processing": true, "bProcessing": true, "bServerSide": true, 'iDisplayLength': 25, "ajax": { "url": "./{{users}}/index.php?module=email_accounts&acc=listforwar", "type": "POST" }, responsive: true }); var table = $('#dataTables-examplemail').on( 'processing.dt', function ( e, settings, processing ) { $('#dataTables-examplemail_processing').css('display', 'none'); if (processing) { $(this).hide(); $('#tab-1 .table-loader-cwp').show(); } else { $('#tab-1 .table-loader-cwp').hide(); $(this).show(); } }).DataTable({ "processing": true, "bProcessing": true, "bServerSide": true, 'iDisplayLength': 25, "ajax": { "url": "./{{users}}/index.php?module=email_accounts&acc=listemail", "type": "POST" }, responsive: true }); var table = $('#dataTables-pipe').on( 'processing.dt', function ( e, settings, processing ) { $('#dataTables-pipe_processing').css('display', 'none'); if (processing) { $(this).hide(); $('#tab-3 .table-loader-cwp').show(); } else { $('#tab-3 .table-loader-cwp').hide(); $(this).show(); } }).DataTable({ "processing": true, "bProcessing": true, "bServerSide": true, 'iDisplayLength': 25, "ajax": { "url": "./{{users}}/index.php?module=email_accounts&acc=pipe&op=list", "type": "POST" }, responsive: true }); }); $('#modal-changepassemail').on('hidden.bs.modal', function (e) { $('#pass1email').val(''); $('#pass2email').val(''); }) function btnaddemail(){ $("#alertemail").hide('blind'); let quotamail = parseInt($("#quotamail").val()); if(($("#emailaddres").val()=='') || ($("#domain").val()=='') || ($("#pass").val()=='') || !Number.isInteger(quotamail)){ if(!Number.isInteger(quotamail)){ $("#quotamail").addClass('error'); } noti_bubble('{{langmod.EFEILDR}}','{{langmod.EMERROR}}','error',false,false,'3000',true); return false; }else{ var pass=$("#pass").val(); pass=pass.replace('&','||@||'); pass=pass.replace('%','|/@/|'); $.ajaxSetup({ headers: { 'csrftoken' : '{{ tokenajax }}' } }); btnporcess('off','btnaddemail','{{ langmod.EMLABEL9 }}'); $.ajax({ type: "POST", url: "./{{users}}/index.php?module=email_accounts&acc=addemail", data: "email="+$("#emailaddres").val()+"&domain="+$("#domain").val()+"&pass="+pass+""amail=" + quotamail, complete: function(datos){ if((datos.responseText==4) || (datos.responseText==5) || (datos.responseText==6)){ if(datos.responseText==4){ var msj='{{langmod.EERROR4}}';} if(datos.responseText==5){ var msj='{{langmod.EERROR5}}';} if(datos.responseText==6){ var msj='{{langmod.EERROR6}}';} noti_bubble(msj,'{{langmod.EMERROR}}','error',false,false,'3000',true); btnporcess('on','btnaddemail','{{ langmod.EADD }}'); return false; }else{ $.ajax({ type: "POST", url: "./{{users}}/index.php?module=email_accounts&acc=listemail", complete: function(datos){ //$('.dataTables-example').DataTable().destroy(); //$("#contftp").html(datos.responseText); //$('.dataTables-example').DataTable(); $('#dataTables-examplemail').DataTable().ajax.reload( function ( json ) { } ); noti_bubble('{{langmod.EMSUCCT}}','{{langmod.EMCREATOK}}','success',false,false,'3000',true); refrespanelnew('email_accounts'); btnporcess('on','btnaddemail','{{ langmod.EADD }}'); $("#addmailmodal").modal('hide'); return false; } }); } } }); return false; } } const refreshList = () => { $.ajax({ type: "POST", url: "./{{users}}/index.php?module=email_accounts&acc=listemail", complete: function(datos){ //$('.dataTables-example').DataTable().destroy(); //$("#contftp").html(datos.responseText); //$('.dataTables-example').DataTable(); $('#dataTables-examplemail').DataTable().ajax.reload( function ( json ) { } ); noti_bubble('{{langmod.EMSUCCT}}','{{langmod.EMCREATOK}}','success',false,false,'3000',true); refrespanelnew('email_accounts'); btnporcess('on','btnaddemail','{{ langmod.EADD }}'); $("#addmailmodal").modal('hide'); return false; } }); } function chancetabemail(sw){ if(sw==0){ $("#indemail").show(); $("#indforw").hide(); }else{ $("#indforw").show(); $("#indemail").hide(); } } $('#editforwarddomain').on('hidden.bs.modal', function (e) { $('#forwardersupd').tagsinput('destroy'); }) function editforwar(elem){ let forward = $(elem).data('forward'); let goto = $(elem).data('goto'); let idtr = $(elem).data('idtr'); var msj='{{langmod.ETITLEFW}}: '+Base64.decode(forward)+'
'; $("#contentmodaludp").html(msj); goto = goto.replace(' ', ''); $("#forwardersupd").val(goto); $("#editforwarddomain").modal('toggle'); $('#forwardersupd').tagsinput({ tagClass: 'cwp-tags-input' }); $('#forwardersupd').on('beforeItemAdd', function(event) { if(!validateEmail(event.item)){ event.cancel = true; $('#invalid_mail_alert').slideDown(); setTimeout(function(){ $('#invalid_mail_alert').slideUp(); }, 3500); } // event.item: contains the item // event.cancel: set to true to prevent the item getting added }); return false; } function forwardactiveTwice(elem){ $('.table-loader-cwp').show(); let email = $(elem).data('emailaddress'); let st = $(elem).data('status'); $.ajax({ type: "POST", dataType: "json", url: "./{{users}}/index.php?module=email_accounts&acc=changestforward", data: "email=" + email+"&st="+st, complete: function (datos) { datos = datos.responseJSON; console.log('datos', datos); if(datos.hasOwnProperty('result') && datos.result == 'success'){ let action_type = '' if(datos.response == 5){ action_type = '{{langmod.EMLFORWARDDEACTIVE}}'; }else{ action_type = '{{langmod.EMLFORWARDACTIVE}}'; } switchEmailST(elem, datos.response); noti_bubble(action_type,'{{langmod.EMSUCCT}}','success',false,false,'3000',true); }else{ noti_bubble('An error occurred','Ups!','error',false,false,'3000',true); } $('.table-loader-cwp').hide(); return false; } }); } function forwardactive(email,st){ $.ajax({ type: "POST", url: "./{{users}}/index.php?module=email_accounts&acc=changestforward", data: "email=" + email+"&st="+st, complete: function (datos) { listforwar(); noti_bubble('{{langmod.EMSUCCT}}','{{langmod.EUPDFORW}}','success',false,false,'3000',true); return false; } }); } function ediquotaemail(email,quota){ $("#quotaemailmodal").val((quota/1024/1024)); $("#quotaemailtitle").html(email); $("#quotaemailhidde").html(email); $("#modal-updquotemail").modal('toggle'); return false; } function emailchangepass(email){ $("#labelemail").html(email); $("#modal-changepassemail").modal('toggle'); $("#emailpass").val(email); return false; } function forwardelete(st,email,tr){ if(st==0){ var strheader = ''+Base64.decode(email)+'
'; var strfooter = ''; $("#deletemodalmail .modal-header").html(strheader); $("#deletemodalmail .modal-body").html(strbody); $("#deletemodalmail .modal-footer").html(strfooter); $("#deletemodalmail").modal('toggle'); return false; }else if(st==1){ btnporcess('off','btnyesdel','{{ langmod.EMLABEL9 }}'); $.ajaxSetup({ headers: { 'csrftoken' : '{{ tokenajax }}' } }); $.ajax({ type: "POST", url: "./{{users}}/index.php?module=email_accounts&acc=forwardelete", data:"email="+Base64.decode(email), complete: function(datos){ listforwar(); btnporcess('off','btnyesdel','{{ langmod.EYES }}'); refrespanelnew('email_forwarders'); noti_bubble('{{langmod.EMSUCCT}}','{{langmod.EMLFORWARDDELETED}}','success',false,false,'3000',true); $("#deletemodalmail").modal('hide'); return false; } }); } } function btnaddforwar(){ $("#alertforwar").hide(); if(($("#forwaraddres").val()=='') || ($("#domainforwar").val()=='') || ($("#forwarders").val()=='')){ noti_bubble('{{langmod.EFEILDR}}','{{langmod.EMERROR}}','error',false,false,'3000',true); return false; }else{ btnporcess('off','btn-addforwar','{{ langmod.EMLABEL9 }}'); $.ajaxSetup({ headers: { 'csrftoken' : '{{ tokenajax }}' } }); $.ajax({ type: "POST", url: "./{{users}}/index.php?module=email_accounts&acc=addforwar", data: "forwaraddres="+$("#forwaraddres").val()+"&domainforwar="+$("#domainforwar").val()+"&forwarders="+$("#forwarders").val(), complete: function(datos){ //alert(datos.responseText); //if((datos.responseText==6) || (datos.responseText==9)){ if(datos.responseText!=''){ //if(datos.responseText==6){ var msj='{{langmod.ERROR6}}'; }else{ var msj='{{langmod.ERROR9}}'; } //noti_bubble(msj,'{{langmod.EMERROR}}','error',false,false,'3000',true); noti_bubble(datos.responseText,'{{langmod.EMERROR}}','error',false,false,'3000',true); btnporcess('on','btn-addforwar','{{ langmod.EYES }}'); return false; } else{ listforwar(); noti_bubble('{{langmod.EMLFORWARDCREATED}}','{{langmod.EMSUCCT}}','success',false,false,'3000',true); refrespanelnew('email_forwarders'); btnporcess('on','btn-addforwar','{{ langmod.EYES }}'); $("#addmailmodal").modal('hide'); } } }); } } function addforwarbtn(){ var vheader=''; // var vbody='