403Webshell
Server IP : 217.160.0.64  /  Your IP : 216.73.216.91
Web Server : Apache
System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User : ws67269618 ( 67269618)
PHP Version : 8.4.28
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /homepages/36/d4298801080/htdocs/gastrobar/app/admin/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /homepages/36/d4298801080/htdocs/gastrobar/app/admin/js/init.js
var vGlobal = new Object();

function inicializar_vGlobal() {
	vGlobal = {
		dir_raiz: document.location.href.replace(DIR_ADMIN, "").replace("#", ""),
		dir_raiz_img: document.location.href.replace(DIR_ADMIN, "").replace("#", "")+"img/",
		id_sesion: "",
		id_empresa: 0,
		id_sucursal: 0,
		nombre_sucursal: "",
		id_usuario: 0,
		nombre_usuario: "",
		prefijo_tablas: "",
		mesas: null,
		cuentas_mesas: null,
		estados_pedidos: new Array(),
		mostrar_mesas_activas: false,
		modulos: new Array(),
		mtos: new Array()
	};
}

function inicializarAplicacion() {
	// Se asigna el id al body.
	$("body").attr("id", ID_BODY);
	
	if(typeof(vGlobal.id_sesion) == "undefined" || vGlobal.id_sesion == "") {
		inicializar_vGlobal();
	}

	if(vGlobal.id_sesion == "") {
		// Se componen las capas principales HTML que existirán en la aplicación.
		var salida = '';
		salida += '<div id="'+ID_CAPA_PRINCIPAL+'" class="container-fluid bg-light div-principal">';
		salida += '<header id="'+ID_CAPA_CABECERA+'" name="'+ID_CAPA_CABECERA+'"></header>';
		salida += '<main role="main" id="'+ID_CAPA_TRABAJO+'" name="'+ID_CAPA_TRABAJO+'" style="scroll:auto;"></main>';
		salida += '</div>';
		salida += '<footer id="'+ID_CAPA_PIE+'" name="'+ID_CAPA_PIE+'"></footer>';
		
		$("#"+ID_BODY).html(salida);
		
		// Se inicializa el popup para el mensaje de espera
		mostrarMensajeEspera();
	
		// Ajuste del tamaño de los IFRAMES.
		$(window).resize(function() {
			recalculaTamanioIframes();
		});
		
		// Para cerrar la sesión correctamente
		$(window).on("beforeunload", function() {
			if(vGlobal.id_sesion != "") {
				salirAplicacion();
			}
		});
	
		// Carga inicial del marco cabecera sin parámetros.
		var load_mCabecera = $.post(cargaRecurso(MTO_CABECERA, MTO_CABECERA));
		$.when(load_mCabecera)
		.done(function (datos_mCabecera) {
			$("#"+ID_CAPA_CABECERA).empty().html(datos_mCabecera);
			$("#"+ID_CAPA_CABECERA+" #titulo_header").html(APP_NAME+((vGlobal.nombre_sucursal != "") ? (": "+vGlobal.nombre_sucursal) : ""));
			var load_mPie = $.post(cargaRecurso(MTO_PIE, MTO_PIE));
			$.when(load_mPie)
			.done(function (datos_mPie) {
				$("#"+ID_CAPA_PIE).empty().html(datos_mPie);
				var load_mTrabajo = $.post(cargaRecurso(MTO_LOGIN, MTO_LOGIN));
				$.when(load_mTrabajo)
				.done(function (datos_mTrabajo) {
					$("#"+ID_CAPA_TRABAJO).empty().html(datos_mTrabajo);
					recalculaTamanioIframes();
				});
			});
		});
	
		cerrarMensajeEspera();
	} else { // SE FINALIZA LA APLICACIÓN.
		var settingsAjax = {
			type: "POST",
			url: DIR_CORE+FUN_FIN_SESION+'.php',
			contentType: "application/x-www-form-urlencoded",
			async: false,
			datatype : "application/json",
			data: "id_sesion="+vGlobal.id_sesion,
			beforeSend: function(objeto) {
				mostrarMensajeEspera();
			}
		};
	
		$.ajax(settingsAjax)
		.done(function(datos) {
			$("#"+ID_BODY).html(mostrarMensajePantalla(1, datos.mensaje));
		})
		.fail(function( xhr, status, errorThrown ) {
			mostrarErrorGeneral(xhr, status, errorThrown);
		});
	}
}

function inicializarCabecera() {
	cargarCabecera();
}

function recalculaTamanioIframes() {
/*
	var altoNavegador = $(window).innerHeight();
	var alto_mCabecera = $("#"+ID_CAPA_CABECERA).outerHeight();
	var alto_mPie = $("#"+ID_CAPA_PIE).outerHeight();

	$("#"+ID_CAPA_PRINCIPAL).height(altoNavegador);

	var alto_mTrabajo = altoNavegador - alto_mCabecera - alto_mPie - 1;
	$("#"+ID_CAPA_TRABAJO).height(alto_mTrabajo);
*/
}

function mostrarMensajeEspera(texto) {
	if(typeof(texto) == "undefined") {
		texto = "CARGANDO...";
	}
	cerrarMensajeEspera();

	// centrar imagen gif
	var height = 80; //El div del titulo, para que se vea mas arriba (H)

	// obtenemos el ancho y alto de la ventana de nuestro navegador, compatible con todos los navegadores
	var ancho = $(window).innerWidth();
	var alto = $(window).innerHeight();

	// se reajusta el tamaño
	var ancho2 = ancho * 0.6;
	var alto2 = alto * 0.4;
	
	// operación necesaria para centrar el div que muestra el mensaje
	var heightdivsito = alto2/2 - parseInt(height)/2; // Se utiliza en el margen superior, para centrar
	
	// imagen que aparece mientras nuestro div es mostrado y da apariencia de cargando
	var imgCentro = '';
	imgCentro = '<div id="contentMensajeEspera" class="centrado-porcentual bg-info" style="border:1px solid; width:'+ancho2+'px; height:'+alto2+'px;">';
	imgCentro += '<div style="text-align:center; height:' + alto2 + 'px;">';
	imgCentro += '<div style="color:#000; margin-top:' + heightdivsito + 'px; font-size:20px; font-weight:bold">' + texto + '</div>';
	imgCentro += '<img src="'+DIR_IMG+IMG_ESPERA+'"/>';
	imgCentro += '</div>';
	imgCentro += '</div>';

	//creamos el div que bloquea grande
	div = document.createElement("div");
	div.id = ID_CAPA_ESPERA;
	div.style.width = ancho + "px";
	div.style.height = alto + "px";
	div.style.display = "none";
	$("#"+ID_BODY).append(div);
	
	//centramos el div del texto
	$("#"+ID_CAPA_ESPERA).html(imgCentro);
	$("#"+ID_CAPA_PRINCIPAL).hide();
	$("#"+ID_CAPA_ESPERA).show();
}

function cerrarMensajeEspera() {
	$("#"+ID_CAPA_ESPERA).remove();
	$("#"+ID_CAPA_PRINCIPAL).show();
}

function cerrarSesion() {
	var settingsAjax = {
		type: "POST",
		url: DIR_CORE+FUN_FIN_SESION+'.php',
		contentType: "application/x-www-form-urlencoded",
		async: false,
		datatype : "application/json",
		data: "id_sesion="+vGlobal.id_sesion,
		beforeSend: function(objeto) {
			mostrarMensajeEspera();
		}
	};

	$.ajax(settingsAjax)
	.done(function(datos) {
		if(datos.error == 0) {
			inicializar_vGlobal();
			vGlobal.mtos.splice(0, vGlobal.mtos.length);

			inicializarAplicacion();
		} else {
			mensajeControl(datos, 0);
		}
	})
	.fail(function( xhr, status, errorThrown ) {
		mostrarErrorGeneral(xhr, status, errorThrown);
	});

	cerrarMensajeEspera();
}

function salirAplicacion() {
	inicializarAplicacion();
}

function validarEstadoSesion(datos) {
	if(typeof(datos.origen) != "undefined") {
		var datosMensaje = { "icono": datos.icono, "mensaje": datos.mensaje };
		mensajeControl(datosMensaje, 0);
		return false;
	}
	return true;
}

function cargarPantallaInicio() {
	var load_mDashboard = $.post(cargaRecurso(MTO_DASHBOARD));
	$.when(load_mDashboard)
	.done(function (datos_mDashboard) {
		$.ajax({
			url: DIR_CORE+FUN_MODULOS_ACCESO+".php",
			type: "POST",
			data: "id_sesion="+vGlobal.id_sesion
		}).done(function (datos) {
				datos = JSON.parse(datos);
				//Una vez que recibimos respuesta
				//comprobamos si la respuesta no es vacía
				if (datos !== "") {
					// Si hay respuesta, comprobamos que no haya errores
					if (datos.error !== 1) {
						vGlobal.modulos = datos.modulos;
						componerPantallaGestion();
					} else {
						datos = { "icono": NUM_ICONO_ATENCION, "mensaje": datos.mensaje };
						mensajeControl(datos, 0);
					}
				} else {
					//Si no hay respuesta, mostramos mensaje
					mostrarErrorGeneral(xhr, status, errorThrown);
				}
		})
		.fail(function( xhr, status, errorThrown ) {
			//Si no hay respuesta, mostramos mensaje
			mostrarErrorGeneral(xhr, status, errorThrown);
		});

		$("#"+ID_CAPA_TRABAJO).empty().html(datos_mDashboard);
		recalculaTamanioIframes();
	});
}


Youez - 2016 - github.com/yon3zu
LinuXploit