Files
2025-06-09 13:55:08 +02:00

488 lines
18 KiB
Plaintext

<%@ page import="com.tarisan.control.*" %>
<%@ page import="com.tarisan.data.*" %>
<%@ page import="com.tarisan.excepcion.*" %>
<%@ page import="com.tarisan.log.*" %>
<%@ page import="com.tarisan.util.Utilidades" %>
<%@ page import="com.tarisan.persistencia.PersistenciaParametros" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.Vector" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%
/* LogTarisan.logger.log(NivelLog.INFO, ((Usuario)sesion.getAttribute("USUARIO")).getMedico() + " - Inicio p&aacute;gina de noticias (med/noticias.jsp)"); */
response.setHeader("Expires", "0");
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
HttpSession sesion = request.getSession(true);
if(sesion.isNew() || (sesion.getAttribute("USUARIO") == null))
{
LogTarisan.logger.log(NivelLog.INFO, "Sesi&oacute;n invalidada");
response.sendRedirect("../../html/login.html");
}
else
{
LogTarisan.logger.log(NivelLog.INFO, ((Usuario)sesion.getAttribute("USUARIO")).getMedico() + " - Inicio p&aacute;gina de noticias (med/noticias.jsp)");
try
{
// Definicion de variables
String strParametroMenu="";
String strCampoNombre="";
StringBuffer strSql = new StringBuffer();
int intPagina=0;
Object aCondiciones[]=null;
SimpleDateFormat sdfFormateadorFecha=new SimpleDateFormat(PersistenciaParametros.formatoFechas);
int intTarifa = ((Usuario)sesion.getAttribute("USUARIO")).getTarifa();
int intEspecialidad = ((Usuario)sesion.getAttribute("USUARIO")).getEspecialidad();
//Obtenci&oacute;n del perfil del usuario conectado
StringBuffer perfil = new StringBuffer();
perfil.append("|");
perfil.append(sesion.getAttribute("PERFIL"));
perfil.append("|");
//Obtenemos los valores de los parametros que se pasan a la pagina
//En caso de que no se le pasen parametros, quedaram inicializados
//a sus valores por defecto
//parametro x para marcar la opcion del menu en la que se encuentra el usuario
if (request.getParameter("x")!=null)
strParametroMenu=(String)request.getParameter("x");
//parametro descripcion para las busquedas
if (request.getParameter("nombre")!=null)
strCampoNombre = (String)request.getParameter("nombre");
//parametro pagina para realizar la paginacion
if (request.getParameter("pagina")!=null)
intPagina=Integer.parseInt(request.getParameter("pagina"));
//Probando WebServiceEntidad
String saludo = "";
if (request.getParameter("saludo")!=null)
saludo = (String)request.getParameter("saludo");
Tamensaje tamensaje = new Tamensaje();
PersistenciaTamensaje pertamensaje = new PersistenciaTamensaje();
Integer medico = Integer.valueOf( ((Usuario)sesion.getAttribute("USUARIO")).getMedico() );
boolean mostrarNoticia = true;
PersistenciaTanoticias perTaNo = new PersistenciaTanoticias();
Vector vSeleccionNot = perTaNo.obtener_noticias_cabecera();
Vector vNoticias = new Vector();
String strNoticia = "";
String noticias ="";
String separador = " ---//--- ";
if(vSeleccionNot.size()==0){
mostrarNoticia = false;
}else{
mostrarNoticia = true;
Tanoticias tanoticia = null;
for(int i = 0; i < vSeleccionNot.size(); i++)
{
tanoticia = (Tanoticias)vSeleccionNot.elementAt(i);
if (i!=0){
strNoticia = strNoticia + separador + tanoticia.getNoticia();
}else{
strNoticia = tanoticia.getNoticia();
}
strNoticia = strNoticia.replaceAll("<br/>", " ");
}
}
%>
<html>
<head>
<title>Noticias</title>
<link rel="shortcut icon" href="../../img/logo.ico" />
<link rel="STYLESHEET" type="text/css" href="../../css/estilos.css">
<script language="JavaScript" src="../../js/inicio_tarisan.js"></script>
<script language="JavaScript" src="../../js/menu_med.js"></script>
<script language="JavaScript" src="../../js/bloques_tarisan.js"></script>
<script language="JavaScript">pNG="<%= perfil.toString() %>"</script>
<script language="JavaScript" src="../../js/funciones.js"></script>
<script language="JavaScript" src="../../js/jquery-1.11.3.js"></script>
<script language="JavaScript" type="text/javascript">
<!--
function pasarAMayusculas(campo)
{
campo.value=campo.value.toUpperCase();
}
function leer(formulario)
{
var nombre = formulario;
nombre.submit();
}
function todas()
{
document.frmTodas.submit();
}
function volver()
{
document.frmVolver.submit();
}
function saludar()
{
document.frmSaludar.submit();
}
function json()
{
document.frmJson.submit();
}
function notiRapida()
{
<% strNoticia = strNoticia.replaceAll("\"", "'"); %>
var not = "<%=strNoticia %>";
tamanioNoticia(not);
$('.marquee').stop(); //
$('.marquee').clearQueue();
marqueeRapido($('.tituloNoticia'), $('.marquee'),not);
}
//-->
</script>
</head>
<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" alink="#43881A" bgcolor="#FFFFFF">
<div class="marco">
<table cellpadding="0" cellspacing="0" border="0" align="center" style="width:95%">
<tr>
<td class="tdLogoCabecera"><img src="<%=request.getContextPath()%>/img/logo.png" class="logoCabecera"></td>
<td>
<table width="100%">
<tr><td class="tituloTablaMedico" align="center"><%= sesion.getAttribute("USUARIO") %></td></tr>
<tr>
<td>
<img src="<%=request.getContextPath()%>/img/arrow.png" class="noticiaRapida" onclick="notiRapida()" title="Pasar R&aacute;pido">
<div id="contenedorNoticia">
<br>
<div class="tituloNoticia">
<p class="marquee"><%=strNoticia %></p>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- Cabecera de Navegaci&oacute;n superior //-->
<table cellpadding="0" cellspacing="0" border="0" align="center" style="width:95%">
<tr>
<td><script language="JavaScript">bloques();</script></td>
</tr>
</table>
<br>
<!-- Cuerpo de la p&aacute;gina //-->
<table cellpadding="0" cellspacing="0" border="0" align="center" style="width:95%">
<tr valign="top">
<!--<td width="180">//-->
<td width="5%">
<!-- Men&uacute; de navegaci&oacute;n del m&oacute;dulo (zona izquierda) //-->
<table cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td colspan="2"><img src="../../img/sp.gif" width="180" height="12" border="0"></td>
</tr>
<tr valign="top">
<td><script language="JavaScript">escribirMenuGst();</script></td>
</tr>
</table>
</td>
<!--<td bgcolor="#CCCCCC"><img src="../../img/sp.gif" width="1" height="12" border="0"></td>//-->
<td width="565">
<!-- Tabla con el contenido de la p&aacute;gina (zona central-derecha) //-->
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td width="1px" bgcolor="#CCCCCC" height="330px"></td>
<!--<td width="1px" bgcolor="#AB8383" height="330px"></td> -->
<td class="txt" valign="top">
<img src="../../img/sp.gif" width="1" height="11" border="0"><br>
<%
//Noticias del cuerpo de la p&aacute;gina
PersistenciaTanoticias per = new PersistenciaTanoticias();
if(request.getParameter("todas")!=null) //Se ha pulsado en ver todas las noticias
{
%>
<div class="cajaCentral">
<div class="tituloCajaCentral">
<span>TODAS LAS NOTICIAS</span>
</div>
<br>
<table border="0" width="95%" align="center">
<%
Vector vSeleccion = per.obtener_noticias(medico,intEspecialidad,intPagina);
if(vSeleccion.size()==0){
%>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2" align="center"><span class="txt">No hay noticias</span></td>
</tr>
<%
}else{
if (intPagina != 0){ //se tiene en cuenta la paginacion
%>
<tr>
<td colspan="2" align="right"><span class="txt">P&aacute;gina <%=per.getPaginacion().getNumeroPagina()%> de <%=per.getPaginacion().getNumeroPaginasTotales()%></span></td>
</tr>
<%
}
%>
<tr>
<td class="cabeceraTabla" align="center" bgcolor="#FFAAAA">Descripcion</td>
<td class="cabeceraTabla" align="center" bgcolor="#FFAAAA">Fecha</td>
</tr>
<%
Tanoticias tanoticia = null;
String estilo = "";
for(int i = 0; i < vSeleccion.size(); i++)
{
if (i % 2 == 0)
{
estilo = "filaA";
}
else
{
estilo = "filaB";
}
tanoticia = (Tanoticias)vSeleccion.elementAt(i);
%>
<tr style="height:25px;" class="trResultados">
<td class="<%=estilo%>" align="left"><%=tanoticia.getNoticia()%></td>
<td class="<%=estilo%>" align="center"><%=sdfFormateadorFecha.format(tanoticia.getFecha())%></td>
</tr>
<%
}
%>
<tr><td colspan="2">&nbsp;</td></tr>
<%
if (intPagina!=0){ //se tiene en cuenta la paginacion %>
<tr><td colspan="2"></td></tr>
<tr>
<td colspan="2">
<table border="0" align="center">
<tr>
<%if (per.getPaginacion().esPrimeraPagina()){%>
<td width="70" align="right"><span class="pagDesactivo">primero</span></td>
<td></td>
<td width="70" align="left"><span class="pagDesactivo">anterior</span></td>
<%}else{%>
<!--<td width="70" align="right"><a href="javascript:paginacion(1)" class="enlace">primero</a></td>-->
<td width="70" align="right"><a href="<%=request.getContextPath()%>/jsp/med/noticias.jsp?x=19&pagina=1" class="enlace">primero</a></td>
<td></td>
<!--<td width="70" align="left"><a href="javascript:paginacion(<%=per.getPaginacion().getNumeroPagina() - 1%>)" class="enlace">anterior</a></td>-->
<td width="70" align="left"><a href="<%=request.getContextPath()%>/jsp/med/noticias.jsp?x=19&pagina=<%=per.getPaginacion().getNumeroPagina() - 1%>" class="enlace">anterior</a></td>
<%}%>
<%if (per.getPaginacion().esUltimaPagina()){%>
<td width="70" align="right"><span class="pagDesactivo">siguiente</span></td>
<td></td>
<td width="70" align="left"><span class="pagDesactivo">&uacute;ltimo</span></td>
<%}else{%>
<!--<td width="70" align="right"><a href="javascript:paginacion(<%=per.getPaginacion().getNumeroPagina() + 1%>)" class="enlace">siguiente</a></td>-->
<td width="70" align="right"><a href="<%=request.getContextPath()%>/jsp/med/noticias.jsp?x=19&pagina=<%=per.getPaginacion().getNumeroPagina() + 1%>" class="enlace">siguiente</a></td>
<td></td>
<!--<td width="70" align="left"><a href="javascript:paginacion(<%=per.getPaginacion().getNumeroPaginasTotales()%>)" class="enlace">&uacute;ltimo</a></td>-->
<td width="70" align="left"><a href="<%=request.getContextPath()%>/jsp/med/noticias.jsp?x=19&pagina=<%=per.getPaginacion().getNumeroPaginasTotales()%>" class="enlace">&uacute;ltimo</a></td>
<%}%>
</tr>
</table>
</td>
</tr>
<%
} //fin if(pagina!=0)
} //fin else (vSeleccion.size()!=0)
%>
<tr>
<td align="left">
<form name="frmVolver" id ="frmVolver" action="noticias.jsp?x=19&pagina=1" method="post">
<a href="javascript:volver()" class="enlace">NOTICIAS SIN LEER</a>
</form>
</td>
</tr>
</table>
</div>
<%
}else{ //Mostramos las noticias no leidas
%>
<div class="cajaCentral">
<div class="tituloCajaCentral">
<span>NOTICIAS SIN LEER</span>
</div>
<br>
<table border="0" width="95%" align="center">
<%
if(request.getParameter("leida")!=null)
{
int not = 0;
not=Integer.parseInt(request.getParameter("leida"));
boolean leida = per.insertarNoticiaLeida(not, medico);
}
Vector vSeleccion = per.obtener_noticias_no_leidas(medico,intEspecialidad,intPagina);
if(vSeleccion.size()==0){
%>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2" align="center"><span class="txt">No hay noticias sin leer</span></td>
</tr>
<%
}else{
if (intPagina != 0){ //se tiene en cuenta la paginacion
%>
<tr>
<td colspan="3" align="right"><span class="txt">P&aacute;gina <%=per.getPaginacion().getNumeroPagina()%> de <%=per.getPaginacion().getNumeroPaginasTotales()%></span></td>
</tr>
<%
}
%>
<tr>
<td class="cabeceraTabla" align="center" bgcolor="#FFAAAA">Descripcion</td>
<td class="cabeceraTabla" align="center" bgcolor="#FFAAAA">Fecha</td>
<td class="cabeceraTabla" align="center" bgcolor="#FFAAAA">Marcar como le&iacute;da</td>
</tr>
<%
Tanoticias tanoticia = null;
String estilo = "";
for(int i = 0; i < vSeleccion.size(); i++)
{
if (i % 2 == 0)
{
estilo = "filaA";
}
else
{
estilo = "filaB";
}
tanoticia = (Tanoticias)vSeleccion.elementAt(i);
%>
<tr style="height:25px;" class="trResultados">
<td class="<%=estilo%>" align="left"><%=tanoticia.getNoticia()%></td>
<td class="<%=estilo%>" align="center"><%=sdfFormateadorFecha.format(tanoticia.getFecha())%></td>
<td class="<%=estilo%>" align="center">
<form name="frmNoticias<%=i%>" id ="frmNoticias<%=i%>" action="noticias.jsp?x=19&pagina=1" method="post" style="margin:0 auto;">
<input type="hidden" name="leida" value="<%=tanoticia.getId_noticia() %>"/>
<a href="javascript:leer(frmNoticias<%=i%>)" class="enlace"> Le&iacute;da</a>
</form>
</td>
</tr>
<%
}
%>
<tr><td colspan="2">&nbsp;</td></tr>
<%
if (intPagina!=0){ //se tiene en cuenta la paginacion %>
<tr><td colspan="2"></td></tr>
<tr>
<td colspan="3">
<table border="0" align="center">
<tr>
<%if (per.getPaginacion().esPrimeraPagina()){%>
<td width="70" align="right"><span class="pagDesactivo">primero</span></td>
<td></td>
<td width="70" align="left"><span class="pagDesactivo">anterior</span></td>
<%}else{%>
<!--<td width="70" align="right"><a href="javascript:paginacion(1)" class="enlace">primero</a></td>-->
<td width="70" align="right"><a href="<%=request.getContextPath()%>/jsp/pac/noticias.jsp?x=19&pagina=1" class="enlace">primero</a></td>
<td></td>
<!--<td width="70" align="left"><a href="javascript:paginacion(<%=per.getPaginacion().getNumeroPagina() - 1%>)" class="enlace">anterior</a></td>-->
<td width="70" align="left"><a href="<%=request.getContextPath()%>/jsp/med/noticias.jsp?x=19&pagina=<%=per.getPaginacion().getNumeroPagina() - 1%>" class="enlace">anterior</a></td>
<%}%>
<%if (per.getPaginacion().esUltimaPagina()){%>
<td width="70" align="right"><span class="pagDesactivo">siguiente</span></td>
<td></td>
<td width="70" align="left"><span class="pagDesactivo">&uacute;ltimo</span></td>
<%}else{%>
<!--<td width="70" align="right"><a href="javascript:paginacion(<%=per.getPaginacion().getNumeroPagina() + 1%>)" class="enlace">siguiente</a></td>-->
<td width="70" align="right"><a href="<%=request.getContextPath()%>/jsp/med/noticias.jsp?x=19&pagina=<%=per.getPaginacion().getNumeroPagina() + 1%>" class="enlace">siguiente</a></td>
<td></td>
<!--<td width="70" align="left"><a href="javascript:paginacion(<%=per.getPaginacion().getNumeroPaginasTotales()%>)" class="enlace">&uacute;ltimo</a></td>-->
<td width="70" align="left"><a href="<%=request.getContextPath()%>/jsp/med/noticias.jsp?x=19&pagina=<%=per.getPaginacion().getNumeroPaginasTotales()%>" class="enlace">&uacute;ltimo</a></td>
<%}%>
</tr>
</table>
</td>
</tr>
<%
} //fin if(pagina!=0)
} //fin else (vSeleccion.size()!=0)
%>
<tr>
<td align="left">
<form name="frmTodas" id ="frmTodas" action="noticias.jsp?x=19&pagina=1" method="post">
<input type="hidden" name="todas" value="1"/>
<a href="javascript:todas()" class="enlace">TODAS LAS NOTICIAS</a>
</form>
</td>
</tr>
</table>
</div>
<%
}
%>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
<script>
var jsMostrarNoticia = <%=mostrarNoticia %>;
if (!jsMostrarNoticia){
document.getElementById('contenedorNoticia').style.display="none";
}else{
<% strNoticia = strNoticia.replaceAll("\"", "'"); %>
var not = "<%=strNoticia %>";
tamanioNoticia(not);
marquee($('.tituloNoticia'), $('.marquee'),not);
}
var jsMostrarSaludo = "<%=saludo %>";
if (jsMostrarSaludo!=""){
alert(jsMostrarSaludo);
}
</script>
<%
}
catch(Exception ex)
{
LogTarisan.logger.log(NivelLog.ERROR, ((Usuario)sesion.getAttribute("USUARIO")).getMedico() + " - Exception: " + ex);
sesion.setAttribute("ERROR", "Error en la presentaci&oacute;n de la p&aacute;gina al usuario.");
response.sendRedirect("../error.jsp");
}
LogTarisan.logger.log(NivelLog.INFO, ((Usuario)sesion.getAttribute("USUARIO")).getMedico() + " - Final p&aacute;gina de noticias (med/noticias.jsp)");
}
%>