añado js
This commit is contained in:
@@ -0,0 +1,160 @@
|
||||
//var pathLOCAL = "../../";
|
||||
|
||||
//IMPORTANTE:
|
||||
//El valor de esta variable se debe corresponder con el contexto de la aplicacion
|
||||
//Si el contexto se cambia a otro distinto de tarisan, es necesario actualizar este valor,
|
||||
//de lo contrario, las pantallas no se verán correctamente.
|
||||
var pathLOCAL = "/tarisan/";
|
||||
|
||||
if (document.images) {
|
||||
//bullets del menu de la izq
|
||||
var bulletAbierto = new Image(); bulletAbierto.src = pathLOCAL+"img/gen_bullet_abierto.gif";
|
||||
var bulletActivo = new Image(); bulletActivo.src = pathLOCAL+"img/gen_bullet_activo.gif";
|
||||
var bulletCerrado = new Image(); bulletCerrado.src = pathLOCAL+"img/gen_bullet_cerrado.gif";
|
||||
var bulletSelect = new Image(); bulletSelect.src = pathLOCAL+"img/gen_bullet_select.gif";
|
||||
var pbullet = new Image(); pbullet.src = pathLOCAL+"img/gen_bullet_cerrado.gif";
|
||||
}
|
||||
|
||||
var pNG="";
|
||||
|
||||
//Las diferentes secciones (menus horizontales)
|
||||
var SECCION_ADMINISTRADOR = "00";
|
||||
var SECCION_MEDICOS = "11";
|
||||
var SECCION_PACIENTES = "12";
|
||||
var SECCION_SALIR = "13";
|
||||
|
||||
|
||||
function seccionesAMostrar( pNG )
|
||||
{
|
||||
var mostrarSeccion = new Array();
|
||||
mostrarSeccion[MEDICO]= true; //Siempre se muestra
|
||||
mostrarSeccion[PACIENTE]= false;
|
||||
|
||||
|
||||
if( pNG.indexOf("MED") != -1 )
|
||||
mostrarSeccion[MEDICO]= true;
|
||||
|
||||
if( pNG.indexOf("PAC") != -1 )
|
||||
mostrarSeccion[PACIENTE]= true;
|
||||
|
||||
if( pNG.indexOf("ADM") != -1 )
|
||||
mostrarSeccion[ADMINISTRADOR]= true;
|
||||
|
||||
|
||||
return mostrarSeccion;
|
||||
|
||||
}
|
||||
// Inicializamos x,y
|
||||
var x = null;
|
||||
var queryValues = getArgs();
|
||||
if (queryValues.x){x = queryValues.x - 0};
|
||||
var y=null;
|
||||
//***************************************
|
||||
function getPerfil()
|
||||
{
|
||||
var perfil = "";
|
||||
perfil = getCookie("PERFIL");
|
||||
if (!perfil)
|
||||
{
|
||||
perfil = ESPECIALISTA;//El perfil por defecto
|
||||
setCookie("PERFIL",perfil);
|
||||
}
|
||||
|
||||
return perfil;
|
||||
}
|
||||
function setCookie(nombre, valor) {
|
||||
document.cookie = nombre + "=" + escape(valor);
|
||||
}
|
||||
|
||||
|
||||
function getCookie(nombre) {
|
||||
var buscamos = nombre + "=";
|
||||
if (document.cookie.length > 0)
|
||||
{
|
||||
i = document.cookie.indexOf(buscamos);
|
||||
if (i != -1)
|
||||
{
|
||||
i += buscamos.length;
|
||||
j = document.cookie.indexOf(";", i);
|
||||
if (j == -1)
|
||||
j = document.cookie.length;
|
||||
return unescape(document.cookie.substring(i,j));
|
||||
}
|
||||
}
|
||||
}
|
||||
function cambiar(nombre,estado) {
|
||||
if (document.images)
|
||||
eval("document."+nombre+".src = "+estado+".src");
|
||||
}
|
||||
|
||||
|
||||
function getSeccion()
|
||||
{
|
||||
var seccionActual = "";
|
||||
seccionActual = getCookie("SECCION");
|
||||
if (!seccionActual)
|
||||
{
|
||||
seccionActual = SECCION_MEDICOS;//La seccion por defecto
|
||||
setCookie("SECCION",seccionActual);
|
||||
}
|
||||
|
||||
return seccionActual;
|
||||
}
|
||||
|
||||
|
||||
function setSeccion( idSeccion )
|
||||
{
|
||||
var seccionActual = "";
|
||||
seccionActual = getCookie("SECCION");
|
||||
|
||||
if ( seccionActual != idSeccion )
|
||||
{
|
||||
if(idSeccion==SECCION_MEDICOS)
|
||||
{
|
||||
document.location.href = pathLOCAL + 'servlet/GestorMedicos?OPCION=4';
|
||||
}
|
||||
else if(idSeccion==SECCION_PACIENTES)
|
||||
{
|
||||
document.location.href = pathLOCAL + 'servlet/GestorPacientes?OPCION=0';
|
||||
}
|
||||
else if(idSeccion==SECCION_ADMINISTRADOR)
|
||||
{
|
||||
document.location.href = pathLOCAL + 'servlet/GestorAdministracion?OPCION=1';
|
||||
}
|
||||
else
|
||||
{
|
||||
document.location.href = pathLOCAL + 'servlet/Logout';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getArgs() {
|
||||
var args = new Object();
|
||||
var query = location.search.substring(1); // quitamos el ? a la cadena
|
||||
var pairs;
|
||||
|
||||
// El parámetro URL es especial, debe venir el último y a partir de él
|
||||
//ya no se procesarán más parámetros, ya que le parámetro url puede tener
|
||||
//a su vez sus propios parámetros.
|
||||
var posUrl = query.indexOf("url=");
|
||||
if (posUrl == -1)
|
||||
posUrl = query.indexOf("url=");
|
||||
if (posUrl > -1)
|
||||
{
|
||||
//Se ha encontrado el parámetro URL.
|
||||
args["url"] = query.substring(posUrl+4);
|
||||
query = query.substring(0,posUrl);
|
||||
}
|
||||
|
||||
pairs = query.split("&"); // troceamos la cadena por los &
|
||||
|
||||
|
||||
for (var i=0; i < pairs.length; i++) {
|
||||
var pos = pairs[i].indexOf('='); // Busca nombre=valor
|
||||
if (pos == -1) continue;
|
||||
var argName = pairs[i].substring(0,pos); // el nombre
|
||||
var argValue = pairs[i].substring(pos+1); // el valor
|
||||
args [argName] = unescape(argValue); // lo guarda como propiedad
|
||||
}
|
||||
return args;
|
||||
}
|
||||
Reference in New Issue
Block a user