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

427 lines
17 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="java.sql.*" %>
<%@ page import="java.util.Vector" %>
<%@ page import="java.io.*" %>
<%
// LogTarisan.logger.log(NivelLog.INFO, ((Usuario)sesion.getAttribute("USUARIO")).getMedico() + "Inicio página de cabecera (med/cabecera.jsp)");
response.setHeader("Expires", "0");
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
HttpSession sesion = request.getSession(true);
String mensaje = "";
mensaje = (String)sesion.getAttribute("MSG");
sesion.setAttribute("MSG", "");
if(sesion.isNew() || (sesion.getAttribute("USUARIO") == null))
{
LogTarisan.logger.log(NivelLog.INFO, "Sesión invalidada");
response.sendRedirect("../../html/login.html");
}
else
{
LogTarisan.logger.log(NivelLog.INFO, ((Usuario)sesion.getAttribute("USUARIO")).getMedico() + "Inicio página de cabecera (med/cabecera.jsp)");
try
{
// Definicion de variables
String strParametroMenu="";
Usuario usuario = (Usuario)sesion.getAttribute("USUARIO");
int intMedico=((Usuario)sesion.getAttribute("USUARIO")).getMedico();
int intEspecialidad=((Usuario)sesion.getAttribute("USUARIO")).getEspecialidad();
String strNombre = "";
String strDireccion = "";
String strPoblacion = "";
String strTelefono = "";
String strColegiado = "";
String strEspe = "";
String strErrorLogo = "";
String strEmail = "";
Integer intEmail = 0;
//Obtenció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 err para controlar los errores del logotipo al subirlo al servidor
if (request.getParameter("err")!=null)
strErrorLogo=(String)request.getParameter("err");
//parametro intEmail para poner el focus en el email
if (request.getParameter("email")!=null){
intEmail=Integer.parseInt(request.getParameter("email"));
}
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>Cabecera</title>
<link rel="shortcut icon" href="../../img/logo.ico" />
<link rel="STYLESHEET" type="text/css" href="../../css/estilos.css">
<link rel="STYLESHEET" type="text/css" href="../../css/jquery.modal.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" src="../../js/jquery.modal.min.js"></script>
<script language="JavaScript" type="text/javascript">
<!--
function enviar()
{
elem=document.getElementsByName("ch");
if (elem[0].checked && elem[1].checked) {
//alert("Debe marcar una sola posición para el logotipo");
modal({type:'error',title:'¡Atención!',text:'Debe marcar una sola posición para el logotipo.',});
}
else if( (document.getElementById("verImagen").title!="") && (!elem[0].checked && !elem[1].checked) ){
//alert("Debe marcar una posición para el logotipo");
modal({type:'error',title:'¡Atención!',text:'Debe marcar una posición para el logotipo.',});
}
else if( (document.getElementById("verImagen").title=="") && (elem[0].checked || elem[1].checked) ){
//alert("No puedes marcar una posición porque no tienes seleccionado ningun logotipo");
modal({type:'error',title:'¡Atención!',text:'No puedes marcar una posición porque no tienes seleccionado ningun logotipo.',});
for(i=0;i<elem.length;i++) {
if (elem[i].checked) {
elem[i].checked = false;
}
}
}else{
if (elem[0].checked) {
document.frmCabecera.valor_logo_cab.value = elem[0].value;
}else if (elem[1].checked) {
document.frmCabecera.valor_logo_cab.value = elem[1].value;
}
if ((document.frmCabecera.valor_email_cab.value != "") && (!validarEmail(document.frmCabecera.valor_email_cab.value))){
modal({type:'error',title:'¡Atención!',text:'Debe introducir una direccion de correo válida.',callback: function(result){document.frmCabecera.valor_email_cab.focus();}});
}else{
document.frmCabecera.submit();
}
}
}
function eliminarLogo()
{
document.frmLogo.eliminar.value = 1;
document.frmLogo.submit();
}
function posicionarLogotipo()
{
elem=document.getElementsByName("ch");
for(i=0;i<elem.length;i++) {
if (elem[i].checked) { // objeto marcado
/*if (i==0){
elem[1].checked=false; // izquierda
}else{
elem[0].checked=false; // derecha
}*/
resultado = elem[i].value;
}
}
document.frmCabecera.valor_logo_cab.value = resultado;
}
-->
</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>
<div id="contenedorNoticia">
<br>
<div class="tituloNoticia">
<p class="marquee"><%=strNoticia %></p>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- Cabecera de Navegació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ágina //-->
<table cellpadding="0" cellspacing="0" border="0" align="center" style="width:95%">
<tr valign="top">
<!--<td width="180">//-->
<td width="5%">
<!-- Menú de navegación del mó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ágina (zona central-derecha) //-->
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<!--<td><img src="../../img/sp.gif" width="4" height="261" border="0"></td>//-->
<td width="1px" bgcolor="#CCCCCC" height="330px"></td>
<td class="txt" valign="top">
<img src="../../img/sp.gif" width="1" height="11" border="0"><br>
<table border="0" align="center" width="100%">
<!-- Presentacion de los resultados -->
<tr>
<td align="center" class="txtnegrita">
<%
if (mensaje!="" && mensaje!=null){ //Mostrar mensaje de cambios guardados ok
%>
<p style="color:blue"><%=mensaje %></p>
<%
}
%>
</td>
</tr>
<!-- PRUEBA DEL WEB SERVICE DE APEX //-->
<!--
<tr><td colspan="2"><a href="https://192.168.1.102:8181/ords/comercial/agentes" class="enlace">Probar restful sin parametro</a></td></tr>
<tr><td colspan="2"><a href="https://192.168.1.102:8181/ords/comercial/datos_agente/1" class="enlace">Probar restful con parametro</a></td></tr>
<tr><td colspan="2"><a href="https://192.168.1.102:8181/ords/comercial/actualizar/690369592" class="enlace">Probar restful procedure</a></td></tr>
<tr><td colspan="2">&nbsp;</td></tr> //-->
<%PersistenciaTamedico per = new PersistenciaTamedico(); %>
<tr>
<form name="frmCabecera" action="../../servlet/GestorMedicos" method="post">
<input type="hidden" name="x" value="<%=strParametroMenu%>">
<input type="hidden" name="OPCION" value="<%=Constantes.OPC_MED_ACTUALIZAR_CABECERA%>">
<input type="hidden" name="valor_logo_cab" value="" />
<td>
<table border="0" align="center">
<tr>
<td align="right"><span class="txtnegrita">Nombre: </span></td>
<td><input type="text" size="50" name="valor_nombre_cab" class="txt" value="<%=usuario.getNombreCab()%>" maxlength="50"></td>
</tr>
<tr>
<td align="right"><span class="txtnegrita">Dirección: </span></td>
<td><input type="text" size="80" name="valor_direccion_cab" class="txt" value="<%=usuario.getDireccionCab()%>" maxlength="50"></td>
</tr>
<tr>
<td align="right"><span class="txtnegrita">Población: </span></td>
<td><input type="text" size="50" name="valor_poblacion_cab" class="txt" value="<%=usuario.getPoblacionCab()%>" maxlength="50"></td>
</tr>
<tr>
<td align="right"><span class="txtnegrita">Teléfono: </span></td>
<td><input type="text" size="30" name="valor_telefono_cab" class="txt" value="<%=usuario.getTelefonoCab()%>" maxlength="50"></td>
</tr>
<tr>
<td align="right"><span class="txtnegrita">Email: </span></td>
<td><input type="text" size="30" name="valor_email_cab" class="txt" value="<%=usuario.getEmailCab()%>" maxlength="50"></td>
</tr>
<tr>
<td align="right"><span class="txtnegrita">Nº de colegiado: </span></td>
<td><input type="text" size="50" name="valor_Colegiado_cab" class="txt" value="<%=usuario.getColegiadoCab()%>" maxlength="50"></td>
</tr>
<tr>
<td align="right"><span class="txtnegrita">Especialidad: </span></td>
<td><input type="text" size="60" name="valor_especialidad_cab" class="txt" value="<%=usuario.getEspecialidadCab()%>" maxlength="50"></td>
</tr>
<tr>
<td align="right"></td>
<td></td>
</tr>
<tr>
<td align="right"><span class="txtnegrita"></span></td>
</tr>
<tr>
<td colspan="2" align="center"><a href="javascript:frmCabecera.reset()" class="enlace">Deshacer</a>&nbsp;&nbsp;&nbsp;<a href="javascript:enviar()" class="enlace">Aceptar</a></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<table border="0" align="center">
<fieldset style="border:1px solid #D8D8D8; width:80%; margin:0 auto">
<legend><span class="txtnegrita">Logotipo</span></legend>
<div style="float:left">
<fieldset style="border:1px solid #D8D8D8">
<legend>Posición Recetas</legend>
<form name="frmPosicionLogo" action="javascript:posicionarLogotipo()">
<input type="checkbox" name="ch" onclick="this.form.submit();" value="I" <%=((per.obtenerPosicionLogotipo(intMedico)!=null) && (per.obtenerPosicionLogotipo(intMedico).equals("I")))?"checked=checked":"" %>/>IZQUIERDA<br/>
<input type="checkbox" name="ch" onclick="this.form.submit();" value="D" <%=((per.obtenerPosicionLogotipo(intMedico)!=null) && (per.obtenerPosicionLogotipo(intMedico).equals("D")))?"checked=checked":"" %>/>DERECHA
</form>
</fieldset>
</div>
<div style="float:left">
<form name="frmLogo" enctype="multipart/form-data" action="../../../JavaBridgeTemplate621/uploader3.php" method="POST">
<input name="uploadedfile" type="file" /><br/><br/>
<input type="submit" value="Subir logotipo" />
<input type="hidden" name="medico" value="<%=intMedico %>" />
<input type="hidden" name="eliminar" value="" />
</form>
<br/><br/>
<a href="javascript:eliminarLogo()" class="enlace">Eliminar</a>
</div>
<div style="float:right">
<%
File imagenJPG = new File(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".jpg");
File imagenPNG = new File(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".png");
File imagenGIF = new File(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".gif");
File imagenBMP = new File(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".bmp");
if(imagenJPG.exists())
{
//mostrar el logotipo del médico
%>
<img id="verImagen" title=1 src="../../logotipos/<%=intMedico%>.jpg" width="80" height="80" style="border:1px solid grey" hspace="20"></img>
<%
}else if(imagenPNG.exists())
{
%>
<img id="verImagen" title=2 src="../../logotipos/<%=intMedico%>.png" width="80" height="80" style="border:1px solid grey" hspace="20"></img>
<%
}
else if(imagenGIF.exists())
{
%>
<img id="verImagen" title=3 src="../../logotipos/<%=intMedico%>.gif" width="80" height="80" style="border:1px solid grey" hspace="20"></img>
<%
}
else if(imagenBMP.exists())
{
%>
<img id="verImagen" title=4 src="../../logotipos/<%=intMedico%>.bmp" width="80" height="80" style="border:1px solid grey" hspace="20"></img>
<%
}
else{
//mostrar cuadrado en blanco
%>
<img id="verImagen" title="" src="" width="80" height="80" style="border:0.5px solid grey" hspace="20"></img>
<%
}
%>
</div>
<br/>
</fieldset>
<tr>
<td align="left" class="menuOn">
<%
if (strErrorLogo!=""){ //Mostrar mensaje de error de subida del logo
%>
<h3><%=strErrorLogo %></h3>
<%
}
%>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
<% if (intEmail==1)//Controlar si hay que poner el focus en algun textbox
{
%>
<script language="javascript" type="text/javascript">
setTimeout(function(){ document.frmCabecera.valor_email_cab.style.backgroundColor = "#FFAAAA"; }, 500);
setTimeout(function(){ document.frmCabecera.valor_email_cab.style.backgroundColor = "white"; }, 1000);
setTimeout(function(){ document.frmCabecera.valor_email_cab.style.backgroundColor = "#FFAAAA"; }, 1500);
setTimeout(function(){ document.frmCabecera.valor_email_cab.style.backgroundColor = "white"; }, 2000);
setTimeout(function(){ document.frmCabecera.valor_email_cab.style.backgroundColor = "#FFAAAA"; }, 2500);
setTimeout(function(){ document.frmCabecera.valor_email_cab.style.backgroundColor = "white"; }, 3000);
document.frmCabecera.valor_email_cab.focus();
</script>
<%
intEmail=0;
} %>
<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);
}
</script>
<%
}
catch(Exception ex)
{
LogTarisan.logger.log(NivelLog.ERROR, ((Usuario)sesion.getAttribute("USUARIO")).getMedico() + " - Exception: " + ex);
sesion.setAttribute("ERROR", "Error en la presentación de la página al usuario.");
response.sendRedirect("../error.jsp");
}
LogTarisan.logger.log(NivelLog.INFO, ((Usuario)sesion.getAttribute("USUARIO")).getMedico() + "Final página de cabecera (med/cabecera.jsp)");
}
%>