[12e6ddf] | 1 | <!DOCTYPE html> |
---|
| 2 | <html lang="es"> |
---|
| 3 | <head> <!--Inicio del head --> |
---|
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
---|
| 5 | <meta http-equiv="Content-Style-Type" content="text/css"> |
---|
| 6 | <meta http-equiv="Content-Script-Type" content="text/javascript"> |
---|
| 7 | |
---|
| 8 | <link rel="stylesheet" href="css/jquery.Jcrop.css" type="text/css" /> |
---|
| 9 | |
---|
| 10 | <script type="text/javascript" src="js/jquery.min.js"></script> |
---|
| 11 | <script type="text/javascript" src="js/hwcrypto-legacy.js"></script> |
---|
| 12 | <script type="text/javascript" src="js/hwcrypto.js"></script> |
---|
| 13 | <script type="text/javascript" src="js/hex2base.js"></script> |
---|
| 14 | <script type="text/javascript" src="js/forge.min.js"></script> |
---|
| 15 | <script type="text/javascript" src="js/ajaxSetup.js"></script> |
---|
| 16 | <script src="js/jquery.Jcrop.js"></script> |
---|
| 17 | |
---|
| 18 | <script type="text/javascript" charset="utf-8"> |
---|
| 19 | |
---|
| 20 | var urlActiva = "https://"+window.location.hostname; |
---|
| 21 | var jcrop_api; |
---|
| 22 | $(document).ready(function() { |
---|
| 23 | $.ajaxSetup({ |
---|
| 24 | error:function(x,e){ |
---|
| 25 | if(x.status==0){ |
---|
| 26 | alert('Está fuera de línea!!\n Por favor chequee su conexión.'); |
---|
| 27 | }else if(x.status==404){ |
---|
| 28 | alert('La URL solicitada no fue encontrada.'); |
---|
| 29 | }else if(x.status==500){ |
---|
| 30 | alert('Error interno de servidor.'); |
---|
| 31 | }else if(e=='parsererror'){ |
---|
| 32 | alert('Error.\nSolicitud de interpretación de cadena JSON inválida.'); |
---|
| 33 | }else if(e=='timeout'){ |
---|
| 34 | alert('Tiempo de espera alcanzado.'); |
---|
| 35 | }else { |
---|
| 36 | alert('Error desconocido.\n'+x.responseText); |
---|
| 37 | } |
---|
| 38 | } |
---|
| 39 | }); |
---|
| 40 | $("#botonVerifica").click(cargaVerifica); |
---|
| 41 | descargarArchivo = downQuery; |
---|
| 42 | }); |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | function cargaVerifica(){ |
---|
| 46 | if($("#archivoVerifica")[0].files.length>0){ |
---|
| 47 | var formData = new FormData(); |
---|
| 48 | formData.append("upload", $("#archivoVerifica")[0].files[0]); |
---|
| 49 | $.ajax({ |
---|
| 50 | url: urlActiva+"/Murachi/0.4/archivos/firmados", |
---|
| 51 | type: "post", |
---|
| 52 | dataType: "json", |
---|
| 53 | data: formData, |
---|
| 54 | xhr: function() { |
---|
| 55 | var myXhr = $.ajaxSettings.xhr(); |
---|
| 56 | if(myXhr.upload){ |
---|
| 57 | myXhr.upload.addEventListener('progress',progressVerifica, false); |
---|
| 58 | } |
---|
| 59 | return myXhr; |
---|
| 60 | }, |
---|
| 61 | cache: false, |
---|
| 62 | contentType: false, |
---|
| 63 | processData: false, |
---|
| 64 | headers: {"Authorization":"Basic YWRtaW46YWRtaW4="}, |
---|
| 65 | success: function(response) { |
---|
| 66 | $("#mensajeVerifica").html("Archivo subido correctamente"); |
---|
| 67 | for(var key in response) { |
---|
| 68 | //$("#mensajeVerifica").html($("#mensajeVerifica").html()+"<br>"+response[key]) |
---|
| 69 | console.log(key); |
---|
| 70 | } |
---|
| 71 | console.log(response) |
---|
| 72 | $("#mensajeVerifica").html($("#mensajeVerifica").html()+"<br>Cantidad de firmas en el documento: "+response["numberOfSignatures"]); |
---|
| 73 | if(response["numberOfSignatures"]>0){ |
---|
| 74 | $("#mensajeVerifica").html($("#mensajeVerifica").html()+"<br>Firmantes del documento: "); |
---|
| 75 | |
---|
| 76 | for(var n=0;n<response["signatures"].length;n++){ |
---|
| 77 | var datosFirmante = new Array(); |
---|
| 78 | datosFirmante.push("Nombre firmante: "+response["signatures"][n]["nameOfTheSigner"]); |
---|
| 79 | datosFirmante.push("Fecha de la firma: "+response["signatures"][n]["signedOn"]); |
---|
| 80 | var validez = "No"; |
---|
| 81 | if(response["signatures"][n]["signerCertificateStillValid"]){ |
---|
| 82 | validez = "Si"; |
---|
| 83 | } |
---|
| 84 | datosFirmante.push("Certificado válido: "+validez); |
---|
| 85 | //datosFirmante.push("Fecha límite de la validez del certificado: "+response["signatures"][n]["signerCertificateValidTo"]); |
---|
| 86 | //datosFirmante.push("Nombre: "+response["signatures"][n][""]); |
---|
| 87 | $("#mensajeVerifica").html($("#mensajeVerifica").html()+"<blockquote>"+datosFirmante.join("<br>")+"</blockquote>"); |
---|
| 88 | } |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | }, |
---|
| 92 | error: function(jqXHR, textStatus, errorThrown){ |
---|
| 93 | console.log('error: ' + textStatus); |
---|
| 94 | //var responseText = jQuery.parseJSON(jqXHR.responseText); |
---|
| 95 | console.log('ajax error function: ' + jqXHR.responseText); |
---|
| 96 | $("#respuesta").html("error function: " + jqXHR.responseText); |
---|
| 97 | archivoVerificarId = null; |
---|
| 98 | } |
---|
| 99 | }) |
---|
| 100 | }else{ |
---|
| 101 | alert("Debe seleccionar un archivo para verificar primero") |
---|
| 102 | } |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | |
---|
| 106 | function progressVerifica(e){ |
---|
| 107 | if(e.lengthComputable){ |
---|
| 108 | var max = e.total; |
---|
| 109 | var current = e.loaded; |
---|
| 110 | |
---|
| 111 | var Percentage = (current * 100)/max; |
---|
| 112 | console.log(Percentage); |
---|
| 113 | |
---|
| 114 | |
---|
| 115 | if(Percentage >= 100) |
---|
| 116 | { |
---|
| 117 | // process completed |
---|
| 118 | $("#progresoVerifica").html("100 % (Carga completada)"); |
---|
| 119 | }else{ |
---|
| 120 | $("#progresoVerifica").html((Percentage.toFixed(2).replace(".",","))+" %"); |
---|
| 121 | |
---|
| 122 | } |
---|
| 123 | } |
---|
| 124 | } |
---|
| 125 | |
---|
| 126 | </script> |
---|
| 127 | </head> |
---|
| 128 | |
---|
| 129 | |
---|
| 130 | <body> |
---|
| 131 | <table width="1200" border="0" cellspacing="2" cellpadding="5" id="tablaArticulos" align="center"> |
---|
| 132 | <tr> |
---|
| 133 | <td colspan="4" style="text-align:center;">PRUEBA DE MURACHI</td> |
---|
| 134 | </tr> |
---|
| 135 | <tr> |
---|
| 136 | <td colspan="4" style="text-align:center;"> </td> |
---|
| 137 | </tr> |
---|
| 138 | |
---|
| 139 | <tr> |
---|
| 140 | <td colspan="4" style="text-align:center;"> |
---|
| 141 | VERIFICACIÓN DE FIRMAS |
---|
| 142 | </td> |
---|
| 143 | </tr> |
---|
| 144 | |
---|
| 145 | <tr> |
---|
| 146 | <td colspan="4" style="text-align:left;"><input id="archivoVerifica" name="archivoVerifica" type="file" data-min-file-count="1" name="min"></td> |
---|
| 147 | </tr> |
---|
| 148 | <tr> |
---|
| 149 | <td colspan="4" style="text-align:center;" id="progresoVerifica"> |
---|
| 150 | |
---|
| 151 | </td> |
---|
| 152 | </tr> |
---|
| 153 | <tr> |
---|
| 154 | <td colspan="4" style="text-align:center;"> |
---|
| 155 | <div id="mensajeVerifica" style="width:400px;"></div> |
---|
| 156 | </td> |
---|
| 157 | </tr> |
---|
| 158 | <tr> |
---|
| 159 | <td colspan="4" style="text-align:center;"> |
---|
| 160 | <button type="button" class="button" name="botonVerifica" id="botonVerifica">Carga Archivo a Verificar</button> |
---|
| 161 | </td> |
---|
| 162 | </tr> |
---|
| 163 | <tr> |
---|
| 164 | <td colspan="4" style="text-align:center;"> |
---|
| 165 | |
---|
| 166 | </td> |
---|
| 167 | </tr> |
---|
| 168 | <tr> |
---|
| 169 | <td colspan="4" style="text-align:center;"> |
---|
| 170 | |
---|
| 171 | </td> |
---|
| 172 | </tr> |
---|
| 173 | </table> |
---|
| 174 | |
---|
| 175 | </body> |
---|
| 176 | </html> |
---|