$(document).ready(function() { $.extend( $.fn.dataTable.defaults, { "language" : { "sProcessing": "Procesando ...", "sLengthMenu": "Mostrar _MENU_", "sZeroRecords": "No se han encontrado resultados", "sEmptyTable": "Sin datos todavĂ­a", "sInfo": "Mostrando de la entrada _START_ a la _END_ de un total de _TOTAL_ entradas", "sInfoEmpty": "No hay ninguna entrada", "sInfoFiltered": "(filtrado de _MENU_ entradas)", "sSearchPlaceholder": "Buscar", "sInfoPostFix": "", "sSearch": "", "sUrl": "", "oPaginate": { "sFirst": " ", "sPrevious": " ", "sNext": " ", "sLast": " " } } }); }); /* ClassBlockUI.abrirBlockUIEstandar(contenedorIDAMostrar[, accionCerrar, width, headerText]); ClassBlockUI.abrirBlockUIEstandarMensaje(mensaje[, isAlertOrButtons, onClose, width]); */ var ClassBlockUI = { defaultCSS: { "background-color":"#FFFFFF", "border": '2px solid #2B7BB9', "border-radius": "7px", "padding": '15px', //"font-family": "opensansregular", "font-size":"15px", "color": "#666", "text-align":"center", "cursor": "normal", "top": "150px", "position": "absolute", "width": "576px", "left": ($(window).width() - 576 - 2) /2 + 'px' }, restaurarElemento: function() { var data = $("body").data('blockUIEstandar.history'); if (data) { data.object.hide(); data.parent.appendChild(data.el); $("body").removeData('blockUI.history'); } }, abrirBlockUIEstandar: function(contenedorIDAMostrar, accionCerrar, width, headerText) { ClassBlockUI.restaurarElemento(); if(width == undefined || isNaN(width*1)){width = 576;} if(contenedorIDAMostrar == undefined || $("#"+contenedorIDAMostrar).size() == 0){return;} $("html, body").animate({scrollTop:0},"slow"); var object = $("#"+contenedorIDAMostrar); var objectClass = object.attr("class") ? object.attr("class")+"_innercontent" : ""; var objectID = object.attr("id") ? object.attr("id")+"_innercontent" : "blockUI_innercontent"+new Date().getTime(); var node = object[0]; var data = {}; $("body").data('blockUIEstandar.history', data); data.el = node; data.parent = node.parentNode; data.display = node.style.display; data.position = node.style.position; data.object = object; if (data.parent) data.parent.removeChild(node); var header = headerText != undefined ? "
"+headerText+"
" : ""; var blockUIId="blockUI_"+new Date().getTime(); $.blockUI( { css: $.extend(ClassBlockUI.defaultCSS, { "width": width+"px", "left": ($(window).width() - width - 2) /2 + 'px'}), message: "
 
"+header+"
" }); $("#"+objectID).append(node); object.show(); if(accionCerrar==undefined) //boton cerrar tiene accion por defecto { $("#"+blockUIId+" .cerrarBlockUI").unbind("click").makeTagLink($.unblockUI); } else if(accionCerrar==false) //oculta el boton cerrar { $("#"+blockUIId+" .cerrarBlockUI").hide(); } else //boton cerrar con accion especial { $("#"+blockUIId+" .cerrarBlockUI").unbind("click").makeTagLink(accionCerrar); } }, abrirBlockUIEstandarMensaje: function(mensaje, isAlertOrButtons, onClose, width) { ClassBlockUI.restaurarElemento(); if(width == undefined || isNaN(width*1)){width = 576;} $("html, body").animate({scrollTop:0},"slow"); var blockUIId="blockUI_"+new Date().getTime(); if(isAlertOrButtons==undefined) isAlertOrButtons=false; if(onClose==undefined) onClose=false; var botonera = ""; var botoneraEspecial = false; if(isAlertOrButtons === false) { botonera = ""; } else if (isAlertOrButtons === true) { botonera = "


Aceptar
"; } else { botoneraEspecial = true; botonera = "
"; for(var index in isAlertOrButtons) { botonera += " "+isAlertOrButtons[index]["text"]+" "; } botonera += "
"; } $.blockUI( { css: $.extend(ClassBlockUI.defaultCSS, { "width": width+"px", "left": ($(window).width() - width - 2) /2 + 'px'}), message: "
"+mensaje+botonera+"
" }); //Acciones de los botones especiales if(botoneraEspecial) { for(var index in isAlertOrButtons) { $("#"+blockUIId+" ."+index).unbind("click").makeTagLink(isAlertOrButtons[index]["action"]); } } var fnOnClose; if(onClose==false) { fnOnClose = function(){$.unblockUI()}; } else if (typeof onClose === "function") { fnOnClose = function(){onClose()}; } else if (onClose == "location") { fnOnClose = function(){$.query.go();}; } else if (onClose == "back") { fnOnClose = function(){history.go(-1);}; } else { fnOnClose = function(){window.location = onClose}; } $("#"+blockUIId+" .btnCerrarBlockUIAlert").unbind("click").makeTagLink(fnOnClose); }, abrirBlockUIConfirm: function(mensaje, textoAceptar, accionAceptar, textoCancelar, accionCancelar, width) { var buttons = { "btnAceptarBUI_CONFIRM": { "text": textoAceptar, "action": accionAceptar }, "btnCancelarBUI_CONFIRM": { "text": textoCancelar, "action": accionCancelar } }; ClassBlockUI.abrirBlockUIEstandarMensaje(mensaje, buttons, false, width); } };