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

384 lines
13 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" %>
<%
LogTarisan.logger.log(NivelLog.INFO, "Inicio página de mantenimiento de niveles analíticos (adm/mto_niveless.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ón invalidada");
response.sendRedirect("../../html/login.html");
}
else
{
try
{
//Obtención del perfil del usuario conectado
StringBuffer perfil = new StringBuffer();
perfil.append("|");
perfil.append(sesion.getAttribute("PERFIL"));
perfil.append("|");
// Definicion de variables
String strParametroMenu = "";
String strParametroEspe = "0";
String strParametroEspeSol = "0";
int intPagina = 0;
//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");
if (request.getParameter("especialidad")!=null)
strParametroEspe=(String)request.getParameter("especialidad");
if (request.getParameter("especialidadSolicitada")!=null)
strParametroEspeSol=(String)request.getParameter("especialidadSolicitada");
Tamensaje tamensaje = new Tamensaje();
PersistenciaTamensaje pertamensaje = new PersistenciaTamensaje();
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/>", " ");
}
}
//Lo pongo a false para que no salga la noticia
mostrarNoticia = false;
%>
<html>
<head>
<title>Mantenimiento Niveles</title>
<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_adm.js"></script>
<script language="JavaScript" src="../../js/bloques_tarisan.js"></script>
<script language="JavaScript" src="../../js/funciones.js"></script>
<script language="JavaScript" src="../../js/jquery-1.11.3.js"></script>
<script language="JavaScript">pNG="<%= perfil.toString() %>";</script>
<script language="JavaScript" type="text/javascript">
<!--
var modificado = 0;
function pasarAMayusculas(campo)
{
campo.value = campo.value.toUpperCase();
}
function MostrarNiveles(especialidad){
if (document.getElementById("mto_esp").value != 0){
document.getElementById("hiddenEspecialidad").value = document.getElementById("mto_esp").value;
document.getElementById("hiddenEspecialidadSolicitada").value = 0;
document.frmNiveles.submit();
}
}
function MostrarEspecialidadesSolicitadas(){
if (document.getElementById("mto_esp_sol").value != 0){
document.getElementById("hiddenEspecialidadSolicitada").value = document.getElementById("mto_esp_sol").value;
document.frmNiveles.submit();
}
}
function enviar()
{
if (modificado == 1){
document.getElementById("hiddenVisi1").value = document.getElementById("mto_visibilidad1").value;
document.getElementById("hiddenVisi2").value = document.getElementById("mto_visibilidad2").value;
document.getElementById("hiddenVisi3").value = document.getElementById("mto_visibilidad3").value;
document.frmNivVis.submit();
alert("Visibilidad modificada");
} else{
alert("No has modificado ningun valor");
}
}
//-->
</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 de navegación (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>//-->
<!-- Zona central //-->
<td width="565">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td width="1px" bgcolor="#CCCCCC" height="190px"></td>
<td>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td colspan="3">
<table border="0" align="center">
<tr>
<td>&nbsp;</td>
<td align="right"><span class="txtnegrita">Especialidad: </span></td>
<% PersistenciaTanivelEspecialidadTanivelActo per = new PersistenciaTanivelEspecialidadTanivelActo();
Vector vSeleccion = per.obtenerEspecialidades();
if (vSeleccion.size() == 0) //No se han encontrado datos
{
%>
<!-- No hay registros -->
<td colspan="3" align="center"><span class="txt"><% tamensaje = pertamensaje.obtenerMensaje(10); %><%=tamensaje.getMensaje() %></span></td>
<%
}else{
%>
<td><select id="mto_esp" name="especialidades" onchange="MostrarNiveles()">
<option value=0>-- Seleccionar --</option>
<%
TanivelEspecialidad TanivEsp = null;
for(int i = 0; i < vSeleccion.size(); i++)
{
TanivEsp = (TanivelEspecialidad)vSeleccion.elementAt(i);
String descripcion = "";
descripcion = per.ObtenerDescripcion(TanivEsp.getEspecialidad());
%>
<option value="<%=TanivEsp.getEspecialidad()%>" <%=(strParametroEspe.compareTo(String.valueOf(TanivEsp.getEspecialidad()))==0)?"selected=selected":"" %>><%=descripcion %></option>
<%
}
%>
</select></td>
<% }
%>
</tr>
</table>
</td>
</tr>
</table>
<br/>
<br/>
<% if (Integer.parseInt(strParametroEspe)!=0){
%>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td align="right"><span class="txtnegrita">Especialidad Solicitada: </span></td>
<%
Vector vTanivEspeSolicitada = new Vector();
vTanivEspeSolicitada = per.obtenerEspecialidadesSolicitadas(Integer.parseInt(strParametroEspe));
if (vTanivEspeSolicitada.size() == 0) //No se han encontrado datos
{
%>
<!-- No hay registros -->
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td colspan="3" align="center"><span class="txt"><%=tamensaje.getMensaje() %></span></td>
</tr>
<!-- No hay registros -->
<%
}else{
%>
<td><select id="mto_esp_sol" name="mto_esp_sol" onchange="MostrarEspecialidadesSolicitadas()">
<option value=0>-- Seleccionar --</option>
<%
TanivelEspecialidad TanivEspe = null;
for(int i = 0; i < vTanivEspeSolicitada.size(); i++)
{
TanivEspe = (TanivelEspecialidad)vTanivEspeSolicitada.elementAt(i);
String descripcionEspSol = "";
descripcionEspSol = per.ObtenerDescripcion(TanivEspe.getEspecialidad());
%>
<option value="<%=TanivEspe.getEspecialidad()%>"<%=(strParametroEspeSol.compareTo(String.valueOf(TanivEspe.getEspecialidad()))==0)?"selected=selected":"" %>><%=descripcionEspSol %></option>
<%
}
%>
</select></td>
<% }
%>
</tr>
</table>
<br/>
<br/>
<% if (Integer.parseInt(strParametroEspeSol)!=0){
Vector vTanivEspe = new Vector();
vTanivEspe = per.ObtenerNiveles(Integer.parseInt(strParametroEspe),Integer.parseInt(strParametroEspeSol));
if (vTanivEspe.size() == 0) //No se han encontrado datos
{
%>
<!-- No hay registros -->
<table>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td colspan="3" align="center"><span class="txt"><%=tamensaje.getMensaje() %></span></td>
</tr>
</table>
<!-- No hay registros -->
<%
}else{
%>
<form name="frmNivVis" action="../../servlet/GestorAdministracion" method="post">
<table cellpadding="0" border="0" width="90%" align="center">
<tr>
<td class="cabeceraTabla" align="center" bgcolor="#FFAAAA">Nivel</td>
<td class="cabeceraTabla" align="center" bgcolor="#FFAAAA">Visibilidad</td>
</tr>
<%
TanivelEspecialidad TanivEsp = null;
String estilo = "";
for(int i = 0; i < vTanivEspe.size(); i++){
TanivEsp = (TanivelEspecialidad)vTanivEspe.elementAt(i);
if (i % 2 == 0)
{
estilo = "filaA";
}
else
{
estilo = "filaB";
}
%>
<tr>
<td class="<%=estilo%>" align="center"><span class="txtnegrita"><%=TanivEsp.getNivel()%> </span></td>
<td class="<%=estilo%>" align="center"><select id="mto_visibilidad<%=(i+1) %>" name="mto_visibilidad" onchange="modificado=1">
<option value=0 <%=(0==TanivEsp.getVisibilidad())?"selected=selected":"" %>>0 - Invisible</option>
<option value=1 <%=(1==TanivEsp.getVisibilidad())?"selected=selected":"" %>>1 - Permitido</option>
<option value=2 <%=(2==TanivEsp.getVisibilidad())?"selected=selected":"" %>>2 - Justificable</option>
</td>
<td><input type="hidden" name="hiddenNivel<%=(i+1) %>" id="hiddenNivel<%=(i+1) %>" value="<%=TanivEsp.getNivel()%>"></td>
<td><input type="hidden" name="hiddenVisi<%=(i+1)%>" id="hiddenVisi<%=(i+1)%>" value=""></td>
</tr>
<%
}
%>
<input type="hidden" name="hiddenEspe" value="<%=strParametroEspe%>">
<input type="hidden" name="hiddenEspeS" value="<%=strParametroEspeSol%>">
<tr>
<td><input type="hidden" name="OPCION" value="<%=Constantes.OPC_ADM_GES_ACT_VISIBILI%>"></td>
<td colspan="2" align="right"><a href="javascript:enviar()" class="enlace">Aceptar</a></td>
</tr>
</table>
</form>
<%
}
}
}
%>
<form name="frmNiveles" action="../../servlet/GestorAdministracion" method="post">
<input type="hidden" id="hiddenEspecialidad" name="hiddenEspecialidad" value="<%=strParametroEspe%>">
<input type="hidden" id="hiddenEspecialidadSolicitada" name="hiddenEspecialidadSolicitada" value="<%=strParametroEspeSol%>">
<input type="hidden" name="OPCION" value="<%=Constantes.OPC_ADM_GES_NIVELES_ESPE%>">
</form>
</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);
}
</script>
<%
}
catch(Exception ex)
{
LogTarisan.logger.log(NivelLog.ERROR, "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, "Final página de mantenimiento de niveles analíticos (adm/mto_niveles.jsp)");
%>