var _clientMessageContainer; var _clientMessageIntervalID; var _dialogContainer; $(function() { if ($("#clientMessageContainer").size() <= 0) { $('<div id="clientMessageContainer"><dl><dt class="alert_icon"></dt><dd class="alert_context"></dd></dl></div>').prependTo($("body")) } _clientMessageContainer = $("#clientMessageContainer").eq(0); $("a.close", _clientMessageContainer).click(function() { _clientMessageContainer.dialog("close"); return false }); if ($("#dialogContainer").size() <= 0) { $('<div id="dialogContainer" style="display:none"></div>').prependTo($("body")) } _dialogContainer = $("#dialogContainer").eq(0) }); function _showMessage(C, B, A, E, D) { $("dt.alert_icon", _clientMessageContainer).removeClass("alert error"); if (A.toLowerCase() == "error" || A.toLowerCase() == "alert") { $("dt.alert_icon", _clientMessageContainer).addClass(A.toLowerCase()) } $("dd.alert_context", _clientMessageContainer).html(B); _clientMessageContainer.dialog({ title: C, modal: true, resizable: false, overlay: { opacity: 0.5, background: "black" }, buttons: { "确定": function() { $(this).dialog("close") }, "取消": function() { $(this).dialog("close") } } }); _clientMessageContainer.dialog("option", "buttons", { "确定": function() { if (E && D) { E(D) } $(this).dialog("close") }, "取消": function() { $(this).dialog("close") } }); if (!_clientMessageContainer.dialog("isOpen")) { _clientMessageContainer.dialog("open") } } var __unblockTimeoutId = null; function _showLoading(A, B) { $.blockUI({ message: String.format('<div class="loadingBox">{0}</div>', A), showOverlay: false, centerY: false, css: { top: "5px", left: "", right: "5px", width: "125px", height: "20px", backgroundColor: "Transparent", border: "none"} }); if (B && B == true) { if (__unblockTimeoutId != null) { clearTimeout(__unblockTimeoutId) } __unblockTimeoutId = setTimeout($.unblockUI, 3000) } } function _dialogError(A) { _showMessage(Strings.Dialog_Error, A, "error") } function _showError(A) { _clientMessageContainer.removeClass(); _clientMessageContainer.addClass("ErrorPanel"); _clientMessageContainer.html(A); clearInterval(_clientMessageIntervalID); _clientMessageContainer.fadeIn("slow", function() { _clientMessageIntervalID = setInterval(function() { _clientMessageContainer.fadeOut("slow") }, 5000) }) } function _showAjaxMessage(B, C, A) { _dialogContainer.load(B, function() { _dialogContainer.show(); _dialogContainer.dialog({ modal: true, height: 100 }); var E = $(window).width(); var G = $(window).height(); var F = C.offset().left + $("div.ui-dialog").width(); var D = C.offset().top + $("div.ui-dialog").height(); if (F > E) { F = C.offset().left - $("div.ui-dialog").width() } else { F = C.offset().left } if (D > G) { D = C.offset().top - $("div.ui-dialog").height() - 15 } else { D = C.offset().top + 15 } $("div.ui-dialog").css("top", D); $("div.ui-dialog").css("left", F); if (A == true) { C.attr("disabled", "disabled"); C.unbind(); C.click(function() { return false }) } }) };