function FIEL(idContainer, tipo) { this.pendingRequest = false; this.codeBase = 'https://java.sun.com/update/1.6.0/jinstall-6u22-windows-i586.cab#Version=1,6,0,mn'; this.archive = contextPath + '/applet/AppletFIEL.jar'; if (tipo == 1) { this.width = '281'; this.height = '165'; this.code = 'AppletFIELSmall.class'; this.login = true; } else if (tipo == 2) { this.width = '500'; this.height = '250'; this.code = 'AppletFIELInterno.class'; this.login = true; } else { this.width = '500'; this.height = '250'; this.code = 'AppletFIEL.class'; this.login = false; } this.idContainer = idContainer; this.destino = null; this.original = null; this.archivos = []; this.sellos = []; this.rfc = ""; this.certificado = null; this.background = contextPath + '/images/applet/AppletBackground.jpg'; this.firmas = []; } FIEL.prototype.showAuthentication = function() { if (navigator.appVersion.indexOf("MSIE") != -1) { this.writeObject(); } else { this.writeEmbed(); } }; FIEL.prototype.writeObject = function() { var appletHtml = new String(); appletHtml = "\n"; appletHtml += "\n"; appletHtml += "\n"; appletHtml += "\n"; appletHtml += "\n"; appletHtml += "\n"; appletHtml += "\n"; appletHtml += "\n"; appletHtml += "\n"; appletHtml += "\n"; appletHtml += "
[ Se requiere Java Plug-in 1.6 o superior para ejecutar el Applet ]
http://www.java.com/
\n"; appletHtml += "
\n"; var _wrapper = document.getElementById(this.idContainer); _wrapper.innerHTML = appletHtml; }; FIEL.prototype.writeEmbed = function() { var appletHtml = new String(); appletHtml = "\n"; appletHtml += "\n"; appletHtml += "<br/><b>[ Se requiere Java Plug-in 1.6 o superior para ejecutar el Applet ]</b><br/><a href='http://www.java.com/' target='_blank'>http://www.java.com/</a><br/>\n"; appletHtml += "\n"; appletHtml += "\n"; var _wrapper = document.getElementById(this.idContainer); _wrapper.innerHTML = appletHtml; }; FIEL.prototype.setRfc = function(rfc) { this.rfc = rfc; }; FIEL.prototype.initApplet = function() { document.AppFEA.setCadena(this.original); if (!this.login) { document.AppFEA.setRFC(this.rfc); } document.AppFEA.initFiles(); var i = 0; for (i = 0; i < this.firmas.length; i++) { var x = ""; eval("x =" + this.firmas[i].origen + ".value"); if (x != "") { document.AppFEA.addFirma(this.firmas[i].origen, eval(this.firmas[i].origen + ".value"), this.firmas[i].destino); } } }; FIEL.prototype.showSigner = function(certificado) { this.showAuthentication(); this.certificado = certificado; }; FIEL.prototype.showFileSigner = function() { this.showAuthentication(); this.original = null; this.destino = null; }; function setSello(campoDestino, sello, campoOrigen, original) { eval(campoDestino + ".value= sello;"); eval(campoOrigen + ".value= original;"); } FIEL.prototype.addFirma = function(origen, destino) { this.firmas[this.firmas.length] = new Firma(origen, destino); }; function Firma(origen, destino) { this.origen = origen; this.destino = destino; } FIEL.prototype.signFiles = function() { if (document.AppFEA == null) { alert("Primero debe presionar el bot\u00F3n 'Firmar'"); return false; } if (document.AppFEA.getFirma() == null) { alert("Primero debe presionar el bot\u00F3n 'Confirmar'"); return false; } return true; }; FIEL.prototype.addFile = function(origen) { this.archivos[this.archivos.length] = origen; }; FIEL.prototype.validateFiles = function() { var i; var div = document.getElementById("msgUploadDocs"); var msgSinArchivos = "No se ha indicado la ubicaci\u00F3n del archivo"; var alguno = false; for ( i= 0; i < this.archivos.length; i++) { if (!eval(this.archivos[i] + ".value == ''")) { alguno = true; } } if(!alguno) { div.innerHTML = msgSinArchivos; div.style.display = "block"; return false; } var msgNoPdf = "El tipo de documento que trata de anexar no cumple con los requisitos. No est\u00E1 en un formato v\u00E1lido de PDF."; for ( i = 0; i < this.archivos.length; i++) { if (!eval(this.archivos[i] + ".value == ''") && eval(this.archivos[i] + ".value.toUpperCase().indexOf('.PDF') == -1")) { if(div!=null) { div.innerHTML = msgNoPdf; div.style.display = "block"; } else { alert(msgNoPdf); } return false; } } return true; }; FIEL.prototype.validateFile = function() { if (eval($('#documento').val() == '')) { alert("No se ha indicado la ubicaci\u00F3n del archivo"); return false; } if (eval($('#documento').val().indexOf('.pdf') == -1)) { alert("El tipo de documento que trata de anexar no cumple con los requisitos. No est\u00E1 en un formato v\u00E1lido de PDF.2"); return false; } return true; }; FIEL.prototype.authenticate = function() { if (document.AppFEA.getFirma() != null) { document.login.elements["fiel.rfc"].value = document.AppFEA.getRfc(); document.login.elements["fiel.firma"].value = document.AppFEA.getFirma(); document.login.elements["fiel.original"].value = document.AppFEA.getOriginal(); document.login.elements["fiel.serie"].value = document.AppFEA.getSerie(); document.login.elements["fiel.certificado"].value = document.AppFEA.getCertificado(); document.login.submit(); } }; FIEL.prototype.sign = function() { if (document.AppFEA.getFirma() == null) { return false; } else { this.certificado.value = document.AppFEA.getCertificado(); if (this.certificado.value == null || this.certificado.value == "") { return false; } return true; } };