// Recargar datos
var xmlhttp = null;
var xmlhttpsesion = null;
var colaEjecucion = new Array();
function leerDatos() {
//
}
function actualizarSesion() {
$.get('./moduls/actualizar_sesion.php');
}
function guardarDatoTabla(tabla,columna,fila,valor) {
// console.log('./moduls/instancia_dato.php?tabla='+tabla+'&columna='+columna+'&fila='+fila+'&valor='+encodeURIComponent(valor));
url = './moduls/instancia_dato.php?tabla='+tabla+'&columna='+columna+'&fila='+fila+'&valor='+encodeURIComponent(valor);
$.get(url);
}
function guardarDato(id,valor) {
// console.log('./moduls/instancia_dato.php?dato='+id+'&valor='+encodeURIComponent(valor));
url = './moduls/instancia_dato.php?dato='+id+'&valor='+encodeURIComponent(valor);
$.get(url);
}
function guardarSolicitudDato(solicitud,dato,valor) {
xmlhttp =null;
url = './moduls/instancia_dato.php?solicitud='+solicitud+'&dato='+dato+'&valor='+encodeURIComponent(valor);
$.get(url);
/*if (window.XMLHttpRequest) {// code for Firefox, Opera, IE7, etc.
xmlhttp=new XMLHttpRequest();
}else if (window.ActiveXObject) {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp!=null) {
xmlhttp.onreadystatechange=cambioEstado;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
} else {
// Sin soporte de XML HTTP
}*/
}
function guardarSesionParametro(parametro,valor,configuracion) {
xmlhttp =null;
url = './moduls/actualizar_sesion_parametro.php?parametro='+parametro+'&valor='+encodeURIComponent(valor);
if(configuracion!=null) {
if(configuracion) {
url = url+'&configuracion=true';
}
}
$.get(url);
}
function guardarSolicitudValoracion(solicitud,dato,valor) {
xmlhttp =null;
url = './moduls/instancia_dato.php?valoracion=si&solicitud='+solicitud+'&dato='+dato+'&valor='+encodeURIComponent(valor);
$.get(url);
/*if (window.XMLHttpRequest) {// code for Firefox, Opera, IE7, etc.
xmlhttp=new XMLHttpRequest();
}else if (window.ActiveXObject) {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp!=null) {
xmlhttp.onreadystatechange=cambioEstado;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
} else {
// Sin soporte de XML HTTP
}*/
}
function ejecutarAccion(id,valor,nombre) {
if(nombre==null) nombre="";
url = './moduls/instancia_accion.php?dato='+id+'&nombre='+encodeURIComponent(nombre)+'&valor='+encodeURIComponent(valor);
$.get(url,
function(data){
eval(data);
}
);
}
function guardarPosicion(instancia,dato,x,y,ancho,alto) {
xmlhttp =null;
url = './moduls/gestion/instancias_posicion_actualizar.php?dato='+dato+'&instancia='+instancia+'&x='+x+'&y='+y+'&ancho='+ancho+'&alto='+alto;
if (window.XMLHttpRequest) {// code for Firefox, Opera, IE7, etc.
xmlhttp=new XMLHttpRequest();
}else if (window.ActiveXObject) {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp!=null) {
xmlhttp.onreadystatechange=cambioEstado;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
} else {
// Sin soporte de XML HTTP
}
}
function cambioEstado()
{
if (xmlhttp.readyState==4)
{// 4 = "loaded"
if ((xmlhttp.status==200)||(xmlhttp.status==0))
{// 200 = "OK"
//document.getElementById('T1').innerHTML=xmlhttp.responseText;
// alert(xmlhttp.responseText);
}
else
{
alert("Problemilla retrieving data:" + xmlhttp.status);
}
}
}
function cambioEstadoSesion()
{
if(xmlhttp!=null) {
if (xmlhttp.readyState==4)
{// 4 = "loaded"
if ((xmlhttp.status==200)||(xmlhttp.status==0))
{// 200 = "OK"
//document.getElementById('T1').innerHTML=xmlhttp.responseText;
// alert(xmlhttp.responseText);
}
else
{
alert("Problemon retrieving data:" + xmlhttp.status);
}
}
}
}
function cambioEstadoAccion()
{
if (xmlhttp_accion.readyState==4)
{// 4 = "loaded"
if ((xmlhttp.status==200)||(xmlhttp.status==0))
{// 200 = "OK"
//document.getElementById('T1').innerHTML=xmlhttp_accion.responseText;
eval(xmlhttp_accion.responseText);
}
else
{
alert("Problema recibiendo datos:" + xmlhttp_accion.status);
}
}
}
// Mostrar y ocultar elementos
function abrirVentana(direccion) {
window.open(direccion,"_blank");
}
function vaciarCapa(destino) {
document.getElementById(destino).value = '' ;
}
function cambiarDisplay(nombre,tipo) {
if(tipo==null) tipo = "block";
objeto = document.getElementById(nombre);
if (objeto != null) {
// Se discrimina por navegador: si soporta currentStyle, se presupone IE
if (objeto.currentStyle) {
vis = objeto.style; // Comprobar el tipo de display
if (vis.display != tipo) {
vis.display = tipo;
}else{
vis.display = "none";
}
}else{
if ((objeto.style.display=='none')||(objeto.style.display=='')) {
objeto.style.display = tipo;
}else{
objeto.style.display = 'none';
}
}
}
}
function cambiarDisplayFila(nombre) {
$("TR."+nombre).toggle();
/*
objeto = document.getElementById(nombre);
if (objeto != null) {
// Se discrimina por navegador: si soporta currentStyle, se presupone IE
if (objeto.currentStyle) {
vis = objeto.style; // Comprobar el tipo de display
if (vis.display != "table-row") {
vis.display = "block";
}else{
vis.display = "none";
}
}else{
if ((objeto.style.display=='none')||(objeto.style.display=='')) {
objeto.style.display = 'table-row';
}else{
objeto.style.display = 'table-row';
}
}
}*/
}
function ocultarDisplay(nombre) {
objeto = document.getElementById(nombre);
objeto.style.display = 'none';
}
function mostrarDisplay(nombre,tipo) {
objeto = document.getElementById(nombre);
if(tipo==null) {
objeto.style.display = 'block';
}else{
objeto.style.display = tipo;
}
}
function mostrarDisplayCelda(nombre) {
objeto = document.getElementById(nombre);
objeto.style.display = 'block';
}
function mostrarAyuda(titulo,texto) {
$("#ayuda").dialog({
height: 400,
width: 600,
position:"center",
modal: true,
buttons: {
Ok: function() {
$( this ).dialog( "close" );
}
}});
}
function ocultarAyuda() {
}
// Solapas
var solapaActual=null;
function mostrarSolapa(nombre) {
if(solapaActual!=null) {
try {
objeto = document.getElementById("etiqueta_"+solapaActual);
objeto.style.borderBottom = 'black solid 1px';
objeto.style.fontWeight = 'normal';
}catch(err) {
}
ocultarDisplay("solapa_"+solapaActual);
}
solapaActual = nombre;
mostrarDisplay("solapa_"+nombre,"block");
guardarSesionParametro("solapa_",nombre,true);
objeto = document.getElementById("etiqueta_"+nombre);
objeto.style.borderBottom = 'none';
objeto.style.fontWeight = 'bold';
}
function iniciarSolapa(nombre) {
var actual = '';
if(actual=='') {
mostrarSolapa(nombre);
}else{
if(document.getElementById("solapa_"+actual)) {
mostrarSolapa(actual);
}else{
mostrarSolapa(nombre);
}
}
}
// Resaltar elementos
function iluminarCapa(capa) {
var objeto = document.getElementById(capa);
//objeto.style.fontWeight = 'bold';
capaIluminada = capa;
objeto.style.background = '#A0D0FF';
}
function apagarCapa(capa) {
var objeto = document.getElementById(capa);
//objeto.style.fontWeight = 'normal';
objeto.style.background = 'none';
}
function desactivarRadio(objeto) {
if(objeto.checked) {
objeto.checked = false;
setTimeout(function () {
guardarDato(objeto.id.substring(5)," ");
}, 500);
return false;
} else {
return true;
}
}
function iniciarTip(elemento,posicion,tipPosicion) {
if(posicion==null) {
posicion='bottomMiddle';
}
if(tipPosicion==null) {
tipPosicion='topMiddle';
}
if($(elemento).attr("parrafo")) {
$(elemento).qtip({
content: {
url: 'seccion.php?seccion=texto&parrafo',
data: { id: $(elemento).attr("parrafo") },
method: 'get'
},
position: {
corner: {
target: posicion ,
tooltip: tipPosicion}
},
style: {
width:300,
tip: tipPosicion ,
color: 'black',
border: {
width: 4,
radius: 5,
color: '#0059D9'
}
}
});
}else{
$(elemento).qtip({
content: {
url: 'seccion.php?seccion=texto',
data: { id: $(elemento).attr("texto") },
method: 'get'
},
position: {
corner: {
target: posicion ,
tooltip: tipPosicion}
},
style: {
width:300,
tip: tipPosicion ,
color: 'black',
border: {
width: 4,
radius: 5,
color: '#0059D9'
}
}
});
}
}