error 메시지 수정

main
jjh 1 year ago
parent 6bf5b66d76
commit 38ab43f11a

@ -35,7 +35,7 @@ function isEmpty(v) {
|| v == null
|| v == "null"
) return true;
switch (typeof(v)) {
case "string": return "" == trim(v);
case "boolean": if (false == v) return false;
@ -81,13 +81,13 @@ function toQuery(map, encode) {
function uuid() {
var hexDigits = "0123456789abcde",
result = [];
for (var i = 0; i < 36; ++i)
result[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
result[14] = "4";
result[19] = hexDigits.substr((result[19] & 0x3) | 0x8, 1);
result[8] = result[13] = result[18] = result[23] = "-";
return result.join("");
}
@ -130,15 +130,15 @@ var dialog = {
size = " modal-" + size;
tmpl = tmpl.replace(/{size}/, size);
dlg = $(tmpl).appendTo("body");
dlg.find(".modal-body").html(conf.content || "").fadeIn();
dlg.on("hidden.bs.modal", function() {// on dialog close
$("#" + id +",#" + backdropID).remove(); // removes the dialog and its backdrop
if (conf.onClose)
conf.onClose();
});
if (conf.onOK) {
let footer = dlg.find(".modal-footer");
footer.show();
@ -146,7 +146,7 @@ var dialog = {
if (conf.getData) {
var selected = conf.getData.apply();
if (!selected) return;
conf.onOK(selected);
dialog.close(id);
} else {
@ -158,14 +158,14 @@ var dialog = {
if (conf.timeout)
setTimeout(function(){dialog.close(id);}, conf.timeout);
}
dlg.draggable().modal("show");
$(".modal-backdrop").each(function() { // gives id to its backdrop
let backdrop = $(this);
if (!backdrop.prop("id"))
backdrop.prop("id", backdropID);
});
if (conf.init)
conf.init();
},
@ -186,11 +186,11 @@ var dialog = {
function onError(xhr, options, error) {
if (xhr.readyState == 0)
return dialog.alert("서버에 접근할 수 없습니다.");
var resp = JSON.parse(xhr.responseText);
if (resp.handler)
return eval(resp.handler);
var msgs = [];
for (key in resp)
msgs.push(resp[key])
@ -211,35 +211,35 @@ var ajax = {
if (options.data)
options.type = "POST";
}
var success = options.success;
options.success = function(resp) {
if ("string" == typeof resp)
resp = trim(resp);
var stacktrace = resp.stacktrace;
delete resp.stacktrace;
debug("response", resp);
if (!resp.failed)
return success(resp);
dialog.alert({
title:resp.title,
content:resp.message
content:[resp.description, resp.message].join("<br />")
});
debug("stacktrace", stacktrace);
};
var handleError = options.error || onError;
options.error = function(xhr, options, error) {
wait(false);
debug("error", xhr, options, error);
handleError(xhr, options, error);
}
var handleComplete = options.complete || function(){};
options.complete = function() {
wait(false);
@ -450,14 +450,14 @@ $.fn.getValues = function(propertyMapper) {
key = input.prop("id") || input.prop("name"),
value = input.val();
if (isEmpty(key) || value === undefined) return;
var type = input.prop("type");
if ("file" == type) {
value = input.get(0).files;
} else if (["checkbox", "radio"].indexOf(type) > -1) {
if (!input.is(":checked")) return;
}
var stored = inputValues[key];
if (stored === undefined) {
inputValues[key] = value;
@ -473,7 +473,7 @@ $.fn.getValues = function(propertyMapper) {
var array = [stored];
if (!Array.isArray(value))
array.push(value);
else
else
array = array.concat(value);
inputValues[key] = array;
}
@ -492,7 +492,7 @@ $.fn.getValues = function(propertyMapper) {
break;
}
if (value === undefined) continue;
delete inputValues[valueProvider];
inputValues[property] = value;
}
@ -519,10 +519,10 @@ $.fn.getValues = function(propertyMapper) {
function paginate(config) {
var rc = config.totalSize || 0;
// if (!rc) return "";
var fetchCount = config.fetchSize || 0;
// if (!fetchCount) return "";
var fetch = {
all:0,
none:-1,
@ -546,7 +546,7 @@ function paginate(config) {
};
var lc = fetch.count(rc, fetchCount);
if (lc < 2) return "";
var links = ifEmpty(config.links, fetch.all),
page = fetch.page(ifEmpty(config.start, 0), fetchCount),
band = fetch.band(page, links),
@ -578,7 +578,7 @@ function paginate(config) {
next:function(bandCount) {
bandCount = parseInt(bandCount);
if (bandCount - band < 2) return "";
var nextBand = band + 1,
page = nextBand * links,
fromRec = page * fetchCount;
@ -588,7 +588,7 @@ function paginate(config) {
bandCount = parseInt(bandCount);
var lastBand = bandCount - 1;
if (lastBand - band < 2) return "";
var pages = lastBand * links,
fromRec = pages * fetchCount;
return tags.link(config.last, fromRec, pages + 1);
@ -664,7 +664,7 @@ $.fn.setPagingInfo = function(config) {
$.fn.setCurrentRow = function(val) {
if (!val) return;
return this.each(function() {
var e = $(this);
e.find("tr").each(function(){
@ -673,7 +673,7 @@ $.fn.setCurrentRow = function(val) {
if (current)
tr.addClass("current-row");
else
tr.removeClass("current-row");
tr.removeClass("current-row");
});
});
}
@ -684,26 +684,26 @@ class FormFields {
this.children = ["input", "select", "textarea"].map(tag => this.selector + " " + tag).join(",");
this.datamap = [];
}
set(obj) {
document.querySelectorAll(this.children).forEach(input => {
let prop = input.getAttribute("data-map")
|| input.name
|| input.id;
if (!prop) return;
let dataItem = obj instanceof DataItem,
let dataItem = obj instanceof DataItem,
value = dataItem ? obj.getValue(prop) : obj[prop];
if ("radio" == input.type) {
if (value && value == input.value)
input.checked = true;
} else {
input.value = ifEmpty(value, "");
}
}
});
}
get() {
let obj = {};
document.querySelectorAll(this.children).forEach(input => {
@ -748,7 +748,7 @@ function inputsInRange(fromSource, toSource) {
toVal = to.val() || "",
ok = toVal >= fromVal;
if (ok) return;
if ($(this)[0] == from[0])
to.val(from.val())
else

Loading…
Cancel
Save