Changeset 6e6193c in prototipo_portal_2018
- Timestamp:
- Aug 27, 2015, 2:31:59 PM (9 years ago)
- Branches:
- master
- Children:
- 2620b08
- Parents:
- d76b369 (diff), af4112a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- WebContent
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WebContent/index.html
rd76b369 r6e6193c 206 206 var f = $(this); 207 207 // inicio control de los botones radio en el formulario firmar (pdf,bdoc)-------------------------------------------- 208 208 209 //alert("manejo de JsonPDF"); 209 210 … … 224 225 225 226 $.ajax({ 226 url: "https://192.168.12.125:8443/Murachi/0.1/archivos",227 //url: "https://murachi.cenditel.gob.ve/Murachi/0.1/archivos",227 //url: "https://192.168.12.125:8443/Murachi/0.1/archivos", 228 url: "https://murachi.cenditel.gob.ve/Murachi/0.1/archivos", 228 229 type: "post", 229 230 dataType: "json", … … 265 266 type: 'POST', 266 267 contentType: 'application/json', 267 url:"https://192.168.12.125:8443/Murachi/0.1/archivos/pdfs",268 //url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs",268 //url:"https://192.168.12.125:8443/Murachi/0.1/archivos/pdfs", 269 url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs", 269 270 dataType: "json", 270 271 data: parameters, … … 288 289 type: 'POST', 289 290 contentType: 'application/json', 290 url:"https://192.168.12.125:8443/Murachi/0.1/archivos/pdfs/resenas",291 //url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs/resenas",291 //url:"https://192.168.12.125:8443/Murachi/0.1/archivos/pdfs/resenas", 292 url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs/resenas", 292 293 dataType: 'json', 293 294 data: JSON.stringify({"signature":signature.hex}), … … 301 302 302 303 alert("ver respuesta"); 303 var linkToDownload = "<a href=\"https://192.168.12.125:8443/Murachi/0.1/archivos/descargas/" + data['signedFileId'] +"\">descargar archivo firmado</a>";304 //var linkToDownload = "<a href=\"https://192.168.12.125:8443/Murachi/0.1/archivos/descargas/" + data['signedFileId'] +"\">descargar archivo firmado</a>"; 304 305 //var linkToDownload = "<a href=\"https://172.16.137.11:8443/Murachi/murachi/archivos/descargas/" + data['signedFileId'] +"\">descargar archivo firmado</a>"; 305 //var linkToDownload = "<a href=\"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/descargas/" + data['signedFileId'] +"\">descargar archivo firmado</a>";306 var linkToDownload = "<a href=\"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/descargas/" + data['signedFileId'] +"\">descargar archivo firmado</a>"; 306 307 //alert(linkToDownload); 307 308 document.getElementById("respuesta").innerHTML = linkToDownload; … … 388 389 389 390 $.ajax({ 390 url: "https://192.168.12.125:8443/Murachi/0.1/archivos/bdocs/cargas", 391 //url: "https://192.168.12.125:8443/Murachi/0.1/archivos/bdocs/cargas", 392 url: "https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/bdocs/cargas", 391 393 //url: "https://172.16.137.11:8443/Murachi/murachi/archivos", 392 394 //url: "https://172.16.137.11:8443/JAXRS-Murachi/murachi/archivos", … … 433 435 contentType: 'application/json', 434 436 //url:"https://192.168.12.125:8443/Murachi/0.1/archivos/bdocs", 435 url:"https://192.168.12.125:8443/Murachi/0.1/archivos/bdocs/firmas/pre", 437 //url:"https://192.168.12.125:8443/Murachi/0.1/archivos/bdocs/firmas/pre", 438 url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/bdocs/firmas/pre", 436 439 //url:"https://172.16.137.11:8443/Murachi/murachi/archivos/pdfs", 437 440 //url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs", … … 458 461 contentType: 'application/json', 459 462 //url:"https://192.168.12.125:8443/Murachi/0.1/archivos/bdocs/resenas", 460 url:"https://192.168.12.125:8443/Murachi/0.1/archivos/bdocs/firmas/post", 463 //url:"https://192.168.12.125:8443/Murachi/0.1/archivos/bdocs/firmas/post", 464 url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/bdocs/firmas/post", 461 465 //url:"https://172.16.137.11:8443/Murachi/murachi/archivos/pdfs/resenas", 462 466 //url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs/resenas", … … 472 476 473 477 alert("ver respuesta"); 474 var linkToDownload = "<a href=\"https://192.168.12.125:8443/Murachi/0.1/archivos/descargas/" + data['signedFileId'] +"\">descargar archivo firmado</a>";478 //var linkToDownload = "<a href=\"https://192.168.12.125:8443/Murachi/0.1/archivos/descargas/" + data['signedFileId'] +"\">descargar archivo firmado</a>"; 475 479 //var linkToDownload = "<a href=\"https://172.16.137.11:8443/Murachi/murachi/archivos/descargas/" + data['signedFileId'] +"\">descargar archivo firmado</a>"; 476 //var linkToDownload = "<a href=\"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/descargas/" + data['signedFileId'] +"\">descargar archivo firmado</a>";480 var linkToDownload = "<a href=\"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/descargas/" + data['signedFileId'] +"\">descargar archivo firmado</a>"; 477 481 //alert(linkToDownload); 478 482 document.getElementById("respuesta").innerHTML = linkToDownload; … … 557 561 558 562 559 <!-- Prueba de firma de BDOC --> 560 <!-- 561 <script> 562 $(function(){ 563 $("#firmar").on("submit", function(e){ 564 e.preventDefault(); 565 var f = $(this); 566 567 //alert("se presiono firmar") 568 569 //var formData = new FormData(document.getElementById("verificar")); 570 var formData = new FormData(); 571 572 //formData.append("dato", "valor"); 573 formData.append("upload", $("#file-sign")[0].files[0]); 574 //formData.append(f.attr("name"), $(this)[0].files[0]); 575 576 $.ajax({ 577 url: "https://192.168.12.125:8443/Murachi/0.1/archivos", 578 //url: "https://172.16.137.11:8443/Murachi/murachi/archivos", 579 //url: "https://172.16.137.11:8443/JAXRS-Murachi/murachi/archivos", 580 //url: "https://murachi.cenditel.gob.ve/Murachi/0.1/archivos", 581 type: "post", 582 dataType: "json", 583 data: formData, 584 cache: false, 585 contentType: false, 586 processData: false, 587 success: function(response) { 588 //alert(JSON.stringify(response)); 589 var html = manejoJsonPDF(JSON.stringify(response)); 590 //alert(html); 591 //alert("ver respuesta") 592 document.getElementById("respuesta").innerHTML = html; 593 594 // identificador del archivo en el servidor 595 var fileId = response.fileId.toString(); 596 alert("fileId: "+ fileId); 597 598 599 // seleccionar certificado del firmante 600 alert("va a seleccionar certificado"); 601 var cert; 602 window.hwcrypto.getCertificate({lang: "en"}).then(function(response) { 603 var cert = response; 604 //log_text("Using certificate:\n" + hexToPem(response.hex)); 605 606 //alert("cert: "+ cert.hex); 607 608 var parameters = JSON.stringify({ 609 "fileId":fileId, 610 "certificate":cert.hex, 611 "city":"Merida", 612 "state":"Merida", 613 "postalCode":"5101", 614 "country":"Venezuela", 615 "role":"Desarrollador", 616 "addSignature":false 617 }); 618 619 // ahora llamar al ajax de obtener la resena del bdoc 620 $.ajax({ 621 type: 'POST', 622 contentType: 'application/json', 623 url:"https://192.168.12.125:8443/Murachi/0.1/archivos/bdocs", 624 //url:"https://172.16.137.11:8443/Murachi/murachi/archivos/pdfs", 625 //url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs", 626 dataType: "json", 627 data: parameters, 628 success: function(data, textStatus, jqXHR){ 629 var json_x = data; 630 var hash = json_x['hash']; 631 //alert("hash recibido del servidor "+hash); 632 633 var hashtype = "SHA-256"; 634 var lang = "eng"; 635 636 window.hwcrypto.sign(cert, {type: hashtype, hex: hash}, {lang: lang}).then(function(signature) { 637 638 //var signature = response.hex.match(/.{1,64}/g).join("\n"); 639 //log_text("Generated signature:\n" + response.hex.match(/.{1,64}/g).join("\n")); 640 //log_text("Generated signature:\n" + signature.hex); 641 642 alert("valor de la firma: " + signature.hex); 643 644 645 $.ajax({ 646 type: 'POST', 647 contentType: 'application/json', 648 url:"https://192.168.12.125:8443/Murachi/0.1/archivos/bdocs/resenas", 649 //url:"https://172.16.137.11:8443/Murachi/murachi/archivos/pdfs/resenas", 650 //url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs/resenas", 651 dataType: 'json', 652 data: JSON.stringify({"signature":signature.hex}), 653 success: function(data, textStatus, jqXHR){ 654 /* 655 var json_x = data; 656 var msg = json_x['message']; 657 alert('Archivo firmado en el servidor: ' + msg); 658 */ 659 alert('Archivo firmado correctamente: ' + data['signedFileId']); 660 661 alert("ver respuesta"); 662 var linkToDownload = "<a href=\"https://192.168.12.125:8443/Murachi/0.1/archivos/descargas/" + data['signedFileId'] +"\">descargar archivo firmado</a>"; 663 //var linkToDownload = "<a href=\"https://172.16.137.11:8443/Murachi/murachi/archivos/descargas/" + data['signedFileId'] +"\">descargar archivo firmado</a>"; 664 //var linkToDownload = "<a href=\"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/descargas/" + data['signedFileId'] +"\">descargar archivo firmado</a>"; 665 //alert(linkToDownload); 666 document.getElementById("respuesta").innerHTML = linkToDownload; 667 668 669 //descargar el archivo 670 /* 671 //var urlToDownload = "https://192.168.12.125:8443/Murachi/murachi/archivos/descargas/" + data['signedFileId']; 672 $.ajax({ 673 type: 'GET', 674 contentType: false, 675 url: "https://192.168.12.125:8443/Murachi/murachi/archivos/descargas/" + data['signedFileId'], 676 dataType: false, 677 data: false, 678 success: function(data, textStatus, jqXHR){ 679 alert("descargo el archivo"); 680 }, 681 error: function(jqXHR, textStatus, errorThrown){ 682 alert('error en descarga de archivo: ' + textStatus); 683 $("#respuesta").html("error en descarga de archivo: " + textStatus); 684 } 685 }); 686 */ 687 // fin de descarga de archivo 688 689 690 }, 691 error: function(jqXHR, textStatus, errorThrown){ 692 alert('error en /bdocs/resenas: ' + textStatus); 693 $("#respuesta").html("error en /bdocs/resenas: " + textStatus); 694 } 695 }); 696 697 }, function(err) { 698 log_text("sign() failed: " + err); 699 alert("sign() failed: " + err); 700 $("#respuesta").html("sign() failed: " + err); 701 }); 702 703 }, 704 error: function(jqXHR, textStatus, errorThrown){ 705 //alert('error: ' + textStatus); 706 //var responseText = jQuery.parseJSON(jqXHR.responseText); 707 alert('ajax error function: ' + jqXHR.responseText); 708 $("#respuesta").html("error function: " + jqXHR.responseText); 709 } 710 711 712 }); 713 714 715 716 }, function(err) { 717 log_text("getCertificate() failed: " + err); 718 alert("getCertificate() failed: " + err); 719 $("#respuesta").html("getCertificate() failed: " + err); 720 }); 721 722 723 724 }, 725 error: function(response) { 726 //Que se ejecuta cuando finalice la petición de con error 727 $("#respuesta").html('Error...!!!'); 728 alert("ocurrio un error") 729 } 730 }); 731 }); 732 }); 733 </script> 734 --> 735 563 736 564 737 565 <!-- Función que se conecta se servicio web de verificación de la firma electrónica … … 896 724 <!-- <form enctype="multipart/form-data" action="https://192.168.12.125:8443/Murachi/murachi/archivos" method="post" id="firmar"> --> 897 725 <!-- <form enctype="multipart/form-data" action="https://172.16.137.11:8443/Murachi/murachi/archivos" method="post" id="firmar"> --> 726 <<<<<<< HEAD 898 727 <!-- <form enctype="multipart/form-data" action="https://murachi.cenditel.gob.ve/Murachi/0.1/archivos" method="post" id="firmar" name="SignFormat"> --> 728 ======= 729 <form enctype="multipart/form-data" action="https://murachi.cenditel.gob.ve/Murachi/0.1/archivos" method="post" id="firmar" name="SignFormat"> 730 >>>>>>> af4112a625a407cdeac98f2cb85b999cdcc3d17e 899 731 <h2>Formato para la Firma</h2> 900 732 <p>Seleccione el tipo de formato que va a utilizar para firmar electrónicamente</p>
Note: See TracChangeset
for help on using the changeset viewer.