/** Funciones para el notificador **/ var ntf = new Array(); //lista de notificaciones var minX = 37, maxX = 67; //valores iniciales para la barra de notificacion var x = minX; //valor para mover la barra de notificacion var idTO; //ID para time-outs var notfPend = 0; //numero de notificaciones pendientes (sin procesar) var httpRequest; //objeto para acceso via AJAX al servidor var ingresos=0; //Muestra la barra con el mensaje de numero de notificaciones pendientes. function notificar() { //retrNotif(50); var el = document.getElementById("notificacion"); el.style.visibility = "visible"; el.innerHTML = (ntf.length > 0 ? "" : "") + "Tiene " + notfPend + " notificaciones pendientes" + (ntf.length > 0 ? "" : ""); x = minX; mover(1); } //Mediante AJAX obtiene la lista de notificaciones del día function retrNotif(notifPoll) { if (document.getElementById("notifButton") != null) { new Ajax.Request( "FBSNF"+obtieneSesion(), { method: 'post', parameters: "consNotif=true", onComplete: fillList } ); } if (notifPoll) setTimeout("retrNotif(" + notifPoll + ");", notifPoll); } //Llena la lista de notificaciones para que sean leídas por el usuario function fillList(httpRequest) { while (ntf.length > 0) ntf.pop(); var xmlDoc = httpRequest.responseXML; var notf = false; try { notf = xmlDoc.getElementsByTagName("FITBANK")[0].childNodes; }catch (exc) { } notfPend = 0; if (notf && notf[0].nodeName != "EMPTY") { for (var i = 0; i < notf.length; i++) { try { var nom = notf[i].getElementsByTagName("NOM")[0].firstChild.data; var sub = notf[i].getElementsByTagName("SUB")[0].firstChild.data; var trn = notf[i].getElementsByTagName("TRN")[0].firstChild.data; var pnd = notf[i].getElementsByTagName("PND")[0].firstChild.data; var vrs = notf[i].getElementsByTagName("VER")[0].firstChild.data; var fnt = notf[i].getElementsByTagName("FNT")[0].firstChild.data; ntf[i] = new Array(nom, sub, trn, pnd, fnt, vrs); if (pnd != null && pnd == "true") notfPend++; }catch(Exception){ } } } var notifButton = document.getElementById("notifButton"); if (notfPend > 0) notifButton.style.display = "block"; else notifButton.style.display = "none"; } //Mueve la barra de notificacion con animacion function mover(d) { var el = document.getElementById("notificacion"); if (x <= minX) x = minX; el.style.bottom = x + "px"; if (d == "1") { x += 1; el.style.visibility = "visible"; } else x -= 1; if(x <= maxX && x >= minX) idTO = setTimeout("mover(" + d + ")", 1); if (x >= maxX) { clearTimeout(idTO); idTO = setTimeout("mover(0)", 5000); } if (x <= minX) { clearTimeout(idTO); el.style.visibility = "hidden"; } } //Abre la lista de notificaciones function seleccionar() { var html = ''; var el = document.getElementById('listaNotif'); clearTimeout(idTO); mover(0); el.style.visibility = 'visible'; var hei = (1 + ntf.length) * 22; if (hei > 350) hei = 350; el.style.height = hei + 'px'; html += ''; html += ''; html += ''; html += ''; for(var a = 0; a < ntf.length; a++) { var isPend = false; var fecha = ntf[a][4].split(' ')[0]; var hora = ntf[a][4].split(' ')[1].split('.')[0]; hora = hora.replace(/-/g, ':'); if (ntf[a][3] == 'true'){ isPend = true; }else if (ntf[a][3] == 'false'){ continue; } html += ''; html += ''; } html += '
Fecha y horaMensajeSubTran
' : '>') + fecha + ' ' + hora + '' : '>'); html += ''; if (ntf[a][0].length > 50) html += ntf[a][0].substring(0, 50) + '...'; else html += ntf[a][0]; html += '' : '>') + ntf[a][1] + '' : '>') + ntf[a][2] + '
'; el.innerHTML = html; } //Va a la transaccion indicada por la notificacion en la que se hace clic function notifIr(idx) { var el = document.getElementById("listaNotif"); el.style.visibility = "hidden"; globalVars["cambio"] = "pt('" + ntf[idx][1] + ":" + ntf[idx][2] + "')"; if(ntf.length==0){ document.getElementById("notifButton").style.visibility = "hidden"; } if (ntf[idx][3] == "true") { httpRequest = getHTTPObject(); httpRequest.open("GET", "FBSNF"+obtieneSesion()+"?procNotif=true&fnotif=" + escape(ntf[idx][4]), false); httpRequest.send(null); } pt(ntf[idx][1] + ":" + ntf[idx][2]); } //Genera una notificacion automatica function genNotif(codErr) { httpRequest = getHTTPObject(); httpRequest.open("GET", "FBSNF"+obtieneSesion()+"?genNotif=true&codErr=" + codErr, false); httpRequest.send(null); var jsComm = httpRequest.responseText; if (jsComm != null && jsComm != "") { var listNotf = eval(jsComm); if(listNotf){ var confBox = "¿Desea enviar la siguiente notificación?\n\n" + listNotf[5] + "\n\nAl usuario " + listNotf[0] + "\npara que se dirija a la transacción " + listNotf[2] + " " + listNotf[3] + " " + listNotf[4]; if (confirm(confBox)) { httpRequest = getHTTPObject(); httpRequest.open("GET", "FBSNF"+obtieneSesion()+"?procNotif=false&usr=" + listNotf[0] + "&sub=" + listNotf[2] + "&trn=" + listNotf[3] + "&ver=" + listNotf[4] + "&men=" + escape(listNotf[5]), false); httpRequest.send(null); } } } } function separarCampos(sentencia){ arreglo=sentencia.split("") var arregloLocal = new Array(); for(k=1;k')); } }