var totalArchivos = 0; var archivoActual = 0; var listaArchivos = null; var consoleEnabled = false; var modal = null; var porcentaje = 0; function Mapa( key, value, label, tipoDocto ){ this.key = key; this.value = value; this.label = label; this.tipoDocto = tipoDocto; } function Documento(nombreArchivo, nombre, estatus, mensaje) { this.nombreArchivo = nombreArchivo; //*.pdf this.nombre = nombre; // descripcion this.estatus = estatus; this.mensaje = mensaje; } function handleUploadResponse() { porcentaje = (100/totalArchivos)*(archivoActual+1); var finished = iframeOculto.finished; var doc = listaArchivos[archivoActual]; log("Response: " + archivoActual + " - " + doc); progresoCargaDoc(porcentaje); if(finished!=null && finished!=undefined && finished==true) { doc.estatus = iframeOculto.estatus; doc.mensaje = iframeOculto.mensaje; } else { doc.estatus = false; doc.mensaje = 'El documento no pudo ser procesado'; } // submit next archivoActual++; log("Valor de archivoActual " + archivoActual); if(archivoActual") .attr("name", 'documentos[' + i + '].nombreDocumento') .attr("value", doc.nombreArchivo) .appendTo('#solicitud_resultados'); $("") .attr("name", 'documentos[' + i + '].statusDigitalizacion') .attr("value", doc.estatus) .appendTo('#solicitud_resultados'); $("") .attr("name", 'documentos[' + i + '].mensajeGuardado') .attr("value", doc.mensaje) .appendTo('#solicitud_resultados'); } } $('#solicitud_resultados').submit(); cerrarModal(); porcentaje=0; } function AdminDocumentos(forma){ this.archivos = []; this.nameCheck = "anexar"; this.forma = forma; this.title = "Adjuntar nuevo documento"; this.noDocumentosSeleccionados = ""; // this.noDocumentosSeleccionados = "Si desea adjuntar un nuevo documento, seleccione la opci\u00F3n -Adjuntar nuevo documento- y presione el bot\u00F3n 'Adjuntar documentos'"; this.dialogProperties = { title: this.title, modal: true, height: 400, width: 680, resizable:false, closeOnEscape: false, buttons: [ { id:"btnCerrar", text: "Cerrar", "class":"btn btn-default", click: function() { $(this).dialog("close"); } },{ id:"btnAnexar", text:"Adjuntar", "class":"btn btn-primary", click:function(){ var div = document.getElementById("msgUploadDocs"); if(div!=null) { div.innerHTML = ''; div.style.display = "none"; } totalArchivos = parseInt( $('#totalArchivos').val() ); archivoActual = 0; listaArchivos = new Array(); log("Numero de archivos: " + totalArchivos); log("Archivo Actual: " + archivoActual); if( fiel.validateFiles() ) { crearModalProcesando(); progresoCargaDoc(porcentaje); $("#iframeOculto").load( handleUploadResponse ); enviaDocumento(0); } log("termina"); } } ] }; } function adjuntarDoc(){ var div = document.getElementById("msgUploadDocs"); if(div!=null) { div.innerHTML = ''; div.style.display = "none"; } totalArchivos = parseInt( $('#totalArchivos').val() ); archivoActual = 0; listaArchivos = new Array(); log("Numero de archivos: " + totalArchivos); log("Archivo Actual: " + archivoActual); if( fiel.validateFiles() ) { crearModalProcesando(); progresoCargaDoc(porcentaje); $("#iframeOculto").load( handleUploadResponse ); enviaDocumento(0); } log("termina"); } function cerrarDoc(){ $("#uploadDocumentos").css("display", "none"); $("#workingArea").css("display","block"); idContenedorDialogo.append( $("#uploadDocumentos") ); window.scrollTo(0, 0); } function cerrarConfirmation(){ $("#uploadDocumentos").css("display", "none"); $("#workingArea").css("display","block"); idContenedorDialogo.append( $("#uploadDocumentos") ); window.scrollTo(0, 0); } AdminDocumentos.prototype.addFile = function( file ){ this.archivos[this.archivos.length] = file; } AdminDocumentos.prototype.upload = function( ){ var seleccionados = []; var div = document.getElementById("msgAnexarDocs"); if(div!=null) { div.style.display = "none"; } for(var i=0; i 0 ){ var params ="showUploadForm="; for(i=0; i 0 ){ var params ="showUploadForm="; for(i=0; i= 0 ){ var option = new Option( nombreArchivo, idArchivo); var select = this.forma.elements[this.archivos[index].value]; select.options[select.options.length] = option; select.selectedIndex = select.options.length-1; var tipoDocto = this.archivos[index].tipoDocto; // Adicionar los hiddens para los nuevos valores de la coleccion var str = this.archivos[index].value; str = str.substr(0, str.indexOf(".idDocumentoSeleccionado") ); var html = "" + "" + ""; $("#nuevosCampos").append(html); } } AdminDocumentos.prototype.findType = function(tipo){ var index = -1; for(var i=0; i 0 ){ var params ="showUploadForm="; for(i=0; i= 0 ){ var option = new Option( nombreArchivo, idArchivo); var select = this.forma.elements[this.archivos[index].value]; select.options[select.options.length] = option; select.selectedIndex = select.options.length-1; var tipoDocto = this.archivos[index].tipoDocto; // Adicionar los hiddens para los nuevos valores de la coleccion var str = this.archivos[index].value; str = str.substr(0, str.indexOf(".idDocumentoSeleccionado") ); var html = "" + "" + ""; $("#nuevosCampos").append(html); } } AdminDocumentosAlternos.prototype.findType = function(tipo){ //alert("findType"); var index = -1; for(var i=0; i
'); modal.dialog(msgDialogProperties); $('a.ui-dialog-titlebar-close').remove(); modal.dialog("open"); } function progresoCargaDoc(porcentaje) { porcentaje = parseInt(porcentaje); $( "#idPorcentajeDocumento" ).text(porcentaje + "%"); $( "#progressBar" ).progressbar({ value: porcentaje }); }