237 lines
7.7 KiB
Plaintext
237 lines
7.7 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.BufferedWriter" %>
|
|
<%@ page import="java.io.File" %>
|
|
<%@ page import="java.io.FileWriter" %>
|
|
<%@ page import="java.io.IOException" %>
|
|
|
|
|
|
<%
|
|
LogTarisan.logger.log(NivelLog.INFO, "Inicio página de poner cambios en producción (adm/poner_en_produccion.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 = "";
|
|
int intCrearArchivo = 0;
|
|
int intPagina = 0;
|
|
int intMensaje = 0;
|
|
String strMensaje = "";
|
|
|
|
//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 crearArchivo
|
|
if (request.getParameter("crearArchivo")!=null)
|
|
intCrearArchivo=Integer.parseInt(request.getParameter("crearArchivo"));
|
|
|
|
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;
|
|
|
|
if (intCrearArchivo==1){
|
|
|
|
String ruta = "/tmp/ponerCambios/semaforo.txt";
|
|
File archivo = new File(ruta);
|
|
BufferedWriter bw;
|
|
if(archivo.exists()) {
|
|
intMensaje = 1;
|
|
strMensaje = "¡El archivo ya existe!";
|
|
} else {
|
|
bw = new BufferedWriter(new FileWriter(archivo));
|
|
bw.write("Este archivo indica que hay cambios para poner en Tarisan. ");
|
|
bw.write("Por la noche se ejecutará un corntab que subirá los cambios a producción. ");
|
|
bw.write("El crontab ejecuta /root/tarisan_en_produccion_crontab.sh");
|
|
bw.close();
|
|
intMensaje = 1;
|
|
strMensaje = "¡Archivo creado correctamente!";
|
|
}
|
|
|
|
}
|
|
%>
|
|
|
|
<html>
|
|
<head>
|
|
<title>Mantenimiento de Analíticas</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">
|
|
<!--
|
|
function pasarAMayusculas(campo)
|
|
{
|
|
campo.value = campo.value.toUpperCase();
|
|
}
|
|
function ponerCambios()
|
|
{
|
|
document.frmCrearArchivo.crearArchivo.value=1;
|
|
document.frmCrearArchivo.submit();
|
|
}
|
|
|
|
//-->
|
|
</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="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 width="565">
|
|
<form name="frmCrearArchivo" action="<%=request.getContextPath()%>/jsp/adm/poner_en_produccion.jsp?x=<%=strParametroMenu%>" method="post">
|
|
<input type="hidden" name="crearArchivo" value="">
|
|
</form>
|
|
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
|
<tr>
|
|
<td width="1px" bgcolor="#CCCCCC" height="50px"></td>
|
|
<td colspan="2" align="center"><h4 style="color:#43881A"><b>PONER CAMBIOS EN PRODUCCIÓN</b></h4></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="1px" bgcolor="#CCCCCC" height="30px"></td>
|
|
<td colspan="2" align="center"><p style="color:#666666;font-size: small;">Genera el archivo <b>/tmp/ponerCambios/semaforo.txt</b>. Hay un crontab que se ejecuta cada noche y sube los cambios simepre que encuentre el archivo.</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="1px" bgcolor="#CCCCCC"></td>
|
|
<td colspan="2" align="center"><p style="color:#666666;font-size: small;">El crontab ejecuta el archivo <b>/root/tarisan_en_produccion_crontab.sh</b></p></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="1px" bgcolor="#CCCCCC" height="80px"></td>
|
|
<td colspan="2" align="center"><input type="button" name="btnPonerCambios" value='Activar Semáforo' onclick="javascript:ponerCambios()"></td>
|
|
</tr>
|
|
<%
|
|
if (intMensaje == 1){
|
|
%>
|
|
<tr>
|
|
<td width="1px" bgcolor="#CCCCCC" height="80px"></td>
|
|
<td colspan="2" align="center"><p class="franquicias"><%=strMensaje %></p></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 poner cambios en producción (adm/poner_en_produccion.jsp)");
|
|
%>
|