function deletedp(array,usr,name,st){ if(st==0){ //var msj='
{{langmod.MSJDELETE}} '+name+' {{langmod.DPYES}} / {{langmod.DPNOT}}
'; var msj=' {{langmod.MSJDELETE}} '; var btns=' \n' +''; $("#deletemodal .modal-header").html(msj); $("#deletemodal .modal-body").html('

'+name+'

'); $("#deletemodal .modal-footer").html(btns); $("#deletemodal").modal('toggle'); return false; } if(st==1){ $.ajaxSetup({ headers: { 'csrftoken' : '{{ tokenajax }}' } }); $.ajax({ type: "POST", url: "./{{users}}/index.php?module=protected_directory&acc=deletedp", data:"array="+array+"&usr="+usr, complete: function(datos){ $("#deletemodal").modal('hide'); $("#deletemodal .modal-header").html(''); $("#deletemodal .modal-body").html(''); $("#deletemodal .modal-footer").html(''); updatetable(); return false; } }); } } function updatetable(){ $.ajaxSetup({ headers: { 'csrftoken' : '{{ tokenajax }}' } }); $.ajax({ type: "POST", url: "./{{users}}/index.php?module=protected_directory&acc=updatetable", complete: function(datos){ $("#tablebody").html(datos.responseText); return false; } }); return false; } function newdirprotec(){ $("#divbtn-add").hide(); $("#divaddform").show('blind'); return false; } function updatetabledp(){ $.ajaxSetup({ headers: { 'csrftoken' : '{{ tokenajax }}' } }); $.ajax({ type: "POST", url: "./{{users}}/index.php?module=protected_directory&acc=updatetable", complete: function(datos){ $("#tablebodydp").html(datos.responseText); return false; } }); return false; } function searchdir(path){ $.ajaxSetup({ headers: { 'csrftoken' : '{{ tokenajax }}' } }); $.ajax({ type: "POST", url: "./{{users}}/index.php?module=protected_directory&acc=searchdir", data:"path="+path, complete: function(datos){ var newpath=path.replace("/../", "/"); var trozo=datos.responseText.split('|@|'); var str = trozo[0]; $("#divconte").html(str); $("#pathview").html(trozo[1]); $("#hiddenvalue").val(trozo[1]); return false; } }); return false; } function savedp(){ $("#alert1").hide(); var swerror=0; var radio=$('input:radio[name=radio1]:checked').val(); if(radio==0){ var ruta=$("#path1").val(); }else{ var ruta=$("#hiddenvalue").val(); } if(ruta==''){ swerror=1;} if($("#namedp").val()==''){ swerror=1;} if($("#useradd").val()==''){ swerror=1;} if($("#pass1dp").val()==''){ swerror=1;} if($("#pass2dp").val()==''){ swerror=1;} if($("#pass1dp").val()!=$("#pass2dp").val()){swerror=2;} if(swerror==0){ $.ajaxSetup({ headers: { 'csrftoken' : '{{ tokenajax }}' } }); $.ajax({ type: "POST", url: "./{{users}}/index.php?module=protected_directory&acc=createdp", data:"useradd="+$("#useradd").val()+"&dirp="+ruta+"&pass="+$("#pass1dp").val()+"&name="+$("#namedp").val(), complete: function(datos){ updatetabledp(); cancel(); return false; } }); }else if(swerror==1){ noti_bubble('{{langmod.ALLREQ}}','{{langmod.PDIRLABEL3}}','error',true,false,'3000',true); return false; }else if(swerror==2){ noti_bubble('{{langmod.PASSERROR}}','{{langmod.PDIRLABEL3}}','error',true,false,'3000',true); return false; } return false; }