- Timestamp:
- Nov 21, 2017, 4:02:33 PM (7 years ago)
- Branches:
- master
- Children:
- 9add819
- Parents:
- 4db73c3
- Location:
- static
- Files:
-
- 2 added
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
static/js/MultipleSign.js
r4db73c3 rb84cfca 1 2 3 4 function True_FalseMultiples(data){5 6 if (data == "true" ){7 return "Verdadero";8 }9 if (data == "false"){10 return "Falso";11 }12 13 }14 15 function SerealizeMyJsonMultiples(data){16 for (var i = 0; i < data.signatures.length; i++) {17 data.signatures[i].integrityCheck = True_FalseMultiples(data.signatures[i].integrityCheck);18 data.signatures[i].signerCertificateStillValid = True_FalseMultiples(data.signatures[i].signerCertificateStillValid);19 data.signatures[i].signerCertificateValidAtTimeOfSigning = True_FalseMultiples(data.signatures[i].signerCertificateValidAtTimeOfSigning);20 data.signatures[i].signatureCoversWholeDocument = True_FalseMultiples(data.signatures[i].signatureCoversWholeDocument);21 data.signatures[i].certificatesVerifiedAgainstTheKeyStore = True_FalseMultiples(data.signatures[i].certificatesVerifiedAgainstTheKeyStore);22 }23 return data;24 }25 26 27 //Obtenemos la informacion de documento28 function InfoDocumentDataTablePDFMultiples(signedFileId){29 30 $.ajax({31 //url: "https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/"+signedFileId,32 url: "https://192.168.12.154:8443/Murachi/0.1/archivos/"+signedFileId,33 type: "get",34 dataType: "json",35 headers: {"Authorization":"Basic YWRtaW46YWRtaW4="},36 success: function(response) {37 38 39 INFO_DATATABLE_MULTIPLES = SerealizeMyJsonMultiples(response);40 41 CONT_MULTIPLES += 1;42 if (CONT_MULTIPLES == 1){43 DATATABLE_SIGN_MULTIPLES = DataTablePDFMultiples(response);44 45 }46 if (CONT_MULTIPLES > 1){47 DATATABLE_SIGN_MULTIPLES.destroy();48 DATATABLE_SIGN_MULTIPLES = DataTablePDFMultiples(response);49 }50 51 52 $("#Cuerpo_Sign").hide();53 $("#Cuerpo_check").hide();54 $("#well_mensaje").hide();55 $("#button_SignMultiples").hide();56 $("#myJsonPDFMultiples_wrapper").show();57 ListarDocument()58 59 60 61 },62 error: function(jqXHR, textStatus, errorThrown){63 alert(textStatus+", "+ errorThrown+" el documento PDF para mostrar la info de la sign");64 }65 });66 }67 68 69 1 // Cuarto paso (Se envia la información del token para terminar la firma) 70 2 function FinalizarFirmaMultiples(signature){ … … 73 5 type: 'POST', 74 6 contentType: 'application/json', 75 url:"https://192.168.12.154:8443/Murachi/0.1/archivos/pdfs/resenas",76 //url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs/resenas",7 //url:"https://192.168.12.154:8443/Murachi/0.1/archivos/pdfs/resenas", 8 url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs/resenas", 77 9 dataType: 'json', 78 10 data: JSON.stringify({"signature":signature}), … … 104 36 type: 'POST', 105 37 contentType: 'application/json', 106 url:"https://192.168.12.154:8443/Murachi/0.1/archivos/pdfs2",107 //url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs",38 //url:"https://192.168.12.154:8443/Murachi/0.1/archivos/pdfs2", 39 url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs", 108 40 dataType: "json", 109 41 data: parameters, … … 123 55 }, 124 56 function(err) { 125 log_text("sign() failed: " + err);126 57 var error; 127 log_text("sign() failed: " + err);128 58 if(err == "Error: user_cancel") { 129 alert("sign() failed: El usuario cancelo la operación");130 59 error = "El usuario cancelo la operación"; 131 60 } 132 61 else if(err == "Error: no_certificates") { 133 alert("sign() failed: No hay certificado disponible");134 62 error = "No hay certificado disponible"; 135 63 } 136 64 else if(err == "Error: no_implementation") { 137 alert("sign() failed: No hay soporte para el manejo del certificado");138 65 error = "No hay soporte para el manejo del certificado"; 139 66 } 140 141 //alert("sign() failed: " + err); 142 $("#respuesta").html("sign() failed: " + error); 67 simple_modal(error); 143 68 }); 144 69 … … 160 85 161 86 // identificador del archivo en el servidor 162 163 164 87 window.hwcrypto.getCertificate({lang: "en"}).then( 165 88 function(response) { … … 173 96 "reason":"Certificado", 174 97 "location":"CENDITEL", 175 "contact":" 582746574336",98 "contact":"RedGealc", 176 99 "signatureVisible":"false", 177 100 "signaturePage": "", … … 185 108 }, 186 109 function(err) { 187 log_text("getCertificate() failed: " + err);188 110 var error; 189 111 if(err == "Error: user_cancel") { 190 alert("getCertificate() failed: El usuario cancelo la operación" );191 112 error = "El usuario cancelo la operación"; 192 113 } 193 114 else if(err == "Error: no_certificates") { 194 alert("getCertificate() failed: No hay certificado disponible") ;195 115 error = "No hay certificado disponible"; 196 116 } 197 117 else if(err == "Error: no_implementation") { 198 alert("getCertificate() failed: No hay soporte para el manejo del certificado");199 118 error = "No hay soporte para el manejo del certificado"; 200 119 } 201 //alert("getCertificate() failed: " + err); 202 $("#respuesta").html("getCertificate() failed: " + error); 120 simple_modal(error); 203 121 } 204 122 … … 206 124 } 207 125 208 209 function ListarDocument(){210 211 212 $.ajax({213 type: 'POST',214 contentType: 'application/json',215 url:"https://192.168.12.154:8443/Murachi/0.1/archivos/listado",216 //url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs/resenas",217 type: "get",218 dataType: "json",219 headers: {"Authorization":"Basic YWRtaW46YWRtaW4="},220 success: function(response, textStatus, jqXHR){221 222 223 var options = "";224 options += '<option value="-1"> Seleccionar </option>';225 for (var i = 0; i < response.murachiWorkingDirectoryContent.length; i++)226 {227 var data = response.murachiWorkingDirectoryContent[i].split(".");228 if ( data.length > 1 && data[1] == "pdf"){229 options += '<option value="'+response.murachiWorkingDirectoryContent[i]+'" title ="'+response.murachiWorkingDirectoryContent[i]+'">' +response.murachiWorkingDirectoryContent[i] +'</option>';230 }231 }232 233 $('#listadoDocument').html(options);234 $('#listadoDocument option:first').attr('selected', 'selected');235 $("#SelectArchivos").show();236 237 },238 error: function(jqXHR, textStatus, errorThrown){239 alert('error en pdfs/resenas: ' + textStatus);240 $("#respuesta").html("error en pdfs/resenas: " + textStatus);241 }242 });243 244 245 }246 247 248 $("#button_ListarMultiples").on('click', function() {249 ListarDocument();250 });251 252 $("#listadoDocument").on('click', function() {253 var fileId = $("#listadoDocument").val();254 255 if (fileId != -1 ) {256 $("#button_SignMultiples").show();257 }258 else{259 $("#button_SignMultiples").hide();260 }261 262 263 264 });265 266 267 268 $("#Form_sign_multiples").on('submit', function(event) {269 event.preventDefault();270 271 var fileId = $("#listadoDocument").val();272 273 if (fileId != -1 ) {274 ObtenerCertificadoFirmanteMultiples(fileId);275 }276 else{277 alert("Debe selecionar un documeto");278 }279 280 281 });282 -
static/js/funciones.js
rae65f8e rb84cfca 53 53 close:{ 54 54 text:'cerrar', 55 className:' red',55 className:'blue', 56 56 } 57 57 } … … 72 72 html += '<li class="collection-item"><b>Correo: </b>'+data.correo+'</li>'; 73 73 html += '</ul>'; 74 html += '<iframe width="700px" height="600px" src="https://192.168.12.154:8443/Murachi/0.1/archivos/listadopdf/cbcd0924-bbfe-49dc-afc8-f32348f20350.pdf">'; 75 html += '</iframe><br/>'; 76 html += '<a type="button" class="btn waves-effect blue darken-1" onclick="ObtenerCertificadoFirmanteMultiples(\''+data.documento+'\')">'; 77 html += '<i class="material-icons left">mode_edit</i> Firmar</a>'; 74 78 $('#datos_paricipante').html(html); 75 79 }
Note: See TracChangeset
for help on using the changeset viewer.