File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
/**
* jQuery AJAX
*/
function XHR(url, data, callbackFunc, exceptionFunc , localStartFunc , localEndFunc){
$.blockUI({ message : '<h1><img src="/img/blockbusy.gif" /> 잠시만 기다려주세요.</h1>' });
$.ajax({
url: url,
type: "POST",
dataType: "html",
//data: data + "&IS_AJAX_REQUEST=IS_AJAX_REQUEST",
contentType: 'application/x-www-form-urlencoded; charset=utf-8',
data: data,
async: true,
cache: false,
success: function (data, textStatus) {
var result;
try{
result = eval('(' + data + ')');
}catch(ex){
$.unblockUI();
alert(ex);
}
if( typeof(result) == 'object' ){ // JSON 오프젝트로 받음(리턴값이 JSON이거나 Exception 발생시)
if(result._EXCEPTION_){
if(exceptionFunc){ // 익셉션 처리 함수가 있으면
$.unblockUI();
exceptionFunc(result._EXCEPTION_);
}else{
$.unblockUI();
_processException(result._EXCEPTION_);
}
}else if(result._SESSION_OUT_){ // 세션 아웃 처리
alert(result._SESSION_OUT_.message);
if(result._SESSION_OUT_.redirectUrl !=""){
$.unblockUI();
parent.location.href= redirectUrl;
}
}else{
if(callbackFunc){ // 익셉션이 아니고 callback 펑션이 있을때.
$.unblockUI();
callbackFunc(result);
}
}
}else{
if(callbackFunc){ // HTML 형식의 리턴이며 callback 펑션이 있을때.
$.unblockUI();
callbackFunc(data);
}
}
},
beforeSend : function(){ // 로컬 이벤트 , 시작
if(localStartFunc){
$.unblockUI();
localStartFunc();
}
},
complete: function(){ // 로컬 이벤트 , 끝
if(localEndFunc){
$.unblockUI();
localEndFunc();
}
}
});
}
function XHR_OLD(url, data, callbackFunc, exceptionFunc , localStartFunc , localEndFunc){
$.blockUI({ message : '<h1><img src="/img/blockbusy.gif" /> 잠시만 기다려주세요.</h1>' });
jQuery.ajax({
url: url,
type: "POST",
dataType: "html",
//data: data + "&IS_AJAX_REQUEST=IS_AJAX_REQUEST",
contentType: 'application/x-www-form-urlencoded; charset=utf-8',
data: data,
async: true,
cache: false,
success: function (data, textStatus) {
var result;
try{
result = eval('(' + data + ')');
}catch(ex){
$.unblockUI();
alert(ex);
}
if( typeof(result) == 'object' ){ // JSON 오프젝트로 받음(리턴값이 JSON이거나 Exception 발생시)
if(result._EXCEPTION_){
if(exceptionFunc){ // 익셉션 처리 함수가 있으면
$.unblockUI();
exceptionFunc(result._EXCEPTION_);
}else{
$.unblockUI();
_processException(result._EXCEPTION_);
}
}else if(result._SESSION_OUT_){ // 세션 아웃 처리
alert(result._SESSION_OUT_.message);
if(result._SESSION_OUT_.redirectUrl !=""){
$.unblockUI();
parent.location.href= redirectUrl;
}
}else{
if(callbackFunc){ // 익셉션이 아니고 callback 펑션이 있을때.
$.unblockUI();
callbackFunc(result);
}
}
}else{
if(callbackFunc){ // HTML 형식의 리턴이며 callback 펑션이 있을때.
$.unblockUI();
callbackFunc(data);
}
}
},
beforeSend : function(){ // 로컬 이벤트 , 시작
if(localStartFunc){
$.unblockUI();
localStartFunc();
}
},
complete: function(){ // 로컬 이벤트 , 끝
if(localEndFunc){
$.unblockUI();
localEndFunc();
}
}
});
}
//비동기 false
function XHR2(url, data, callbackFunc, exceptionFunc , localStartFunc , localEndFunc){
$.blockUI({ message : '<h1><img src="/img/blockbusy.gif" /> 잠시만 기다려주세요.</h1>' });
$.ajax({
url: url,
type: "POST",
dataType: "html",
//data: data + "&IS_AJAX_REQUEST=IS_AJAX_REQUEST",
contentType: 'application/x-www-form-urlencoded; charset=utf-8',
data: data,
async: false,
cache: false,
success: function (data, textStatus) {
var result;
try{
//시큐어코딩 관련 session이 들어가 있으면 신텍스 에러나기 떄문에 삭제
/* data = data.replace('"SpringSecurityFiltersecurityinterceptorFilterapplied":true,','');
data = data.replace('"SpringSecuritySessionMgmtFilterApplied":true,','');
data = data.replace('"springSecurityContext":org.springframework.security.core.context.SecurityContextImpl@689a8480: Authentication: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@689a8480: Principal: soattorney; Credentials: [PROTECTED]; Authenticated: true; Details: seed.security.SecurityUserDetails@b15278a; Granted Authorities: ROLE_USER,','');
data = data.replace('"springSecurityContext":org.springframework.security.core.context.SecurityContextImpl@7ef97b48: Authentication: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@7ef97b48: Principal: soattorney; Credentials: [PROTECTED]; Authenticated: true; Details: seed.security.SecurityUserDetails@1d76d842; Granted Authorities: ROLE_USER,','');
data = data.replace('"SpringSecurityScpfApplied":true,','');
data = data.replace('"springSecurityContext":org.springframework.security.core.context.SecurityContextImpl@e3239a3: Authentication: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@e3239a3: Principal: soattorney; Credentials: [PROTECTED]; Authenticated: true; Details: seed.security.SecurityUserDetails@6dbd9aa9; Granted Authorities: ROLE_USER,','');
*/
//20191004 주석.
result = eval('(' + data + ')');
}catch(ex){
$.unblockUI();
alert(ex);
}
if( typeof(result) == 'object' ){ // JSON 오프젝트로 받음(리턴값이 JSON이거나 Exception 발생시)
if(result._EXCEPTION_){
if(exceptionFunc){ // 익셉션 처리 함수가 있으면
exceptionFunc(result._EXCEPTION_);
$.unblockUI();
}else{
_processException(result._EXCEPTION_);
$.unblockUI();
}
}else if(result._SESSION_OUT_){ // 세션 아웃 처리
alert(result._SESSION_OUT_.message);
if(result._SESSION_OUT_.redirectUrl !=""){
$.unblockUI();
parent.location.href= redirectUrl;
}
}else{
if(callbackFunc){ // 익셉션이 아니고 callback 펑션이 있을때.
$.unblockUI();
callbackFunc(result);
}
}
}else{
if(callbackFunc){ // HTML 형식의 리턴이며 callback 펑션이 있을 때.
$.unblockUI();
callbackFunc(data);
}
}
},
beforeSend : function(){ // 로컬 이벤트, 시작
if(localStartFunc){
$.unblockUI();
localStartFunc();
}
},
complete: function(){ // 로컬 이벤트, 끝
if(localEndFunc){
$.unblockUI();
localEndFunc();
}
}
});
}
//비동기 false
function XHR2_OLD(url, data, callbackFunc, exceptionFunc , localStartFunc , localEndFunc){
// $.blockUI({ message : '<h1><img src="/img/blockbusy.gif" /> 잠시만 기다려주세요.</h1>' });
jQuery.ajax({
url: url,
type: "POST",
dataType: "html",
//data: data + "&IS_AJAX_REQUEST=IS_AJAX_REQUEST",
contentType: 'application/x-www-form-urlencoded; charset=utf-8',
data: data,
async: false,
cache: false,
success: function (data, textStatus) {
var result;
try{
//시큐어코딩 관련 session이 들어가 있으면 신텍스 에러나기 떄문에 삭제
/* data = data.replace('"SpringSecurityFiltersecurityinterceptorFilterapplied":true,','');
data = data.replace('"SpringSecuritySessionMgmtFilterApplied":true,','');
data = data.replace('"springSecurityContext":org.springframework.security.core.context.SecurityContextImpl@689a8480: Authentication: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@689a8480: Principal: soattorney; Credentials: [PROTECTED]; Authenticated: true; Details: seed.security.SecurityUserDetails@b15278a; Granted Authorities: ROLE_USER,','');
data = data.replace('"springSecurityContext":org.springframework.security.core.context.SecurityContextImpl@7ef97b48: Authentication: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@7ef97b48: Principal: soattorney; Credentials: [PROTECTED]; Authenticated: true; Details: seed.security.SecurityUserDetails@1d76d842; Granted Authorities: ROLE_USER,','');
data = data.replace('"SpringSecurityScpfApplied":true,','');
data = data.replace('"springSecurityContext":org.springframework.security.core.context.SecurityContextImpl@e3239a3: Authentication: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@e3239a3: Principal: soattorney; Credentials: [PROTECTED]; Authenticated: true; Details: seed.security.SecurityUserDetails@6dbd9aa9; Granted Authorities: ROLE_USER,','');
*/
//20191004 주석.
result = eval('(' + data + ')');
}catch(ex){
$.unblockUI();
alert(ex);
}
if( typeof(result) == 'object' ){ // JSON 오프젝트로 받음(리턴값이 JSON이거나 Exception 발생시)
if(result._EXCEPTION_){
if(exceptionFunc){ // 익셉션 처리 함수가 있으면
exceptionFunc(result._EXCEPTION_);
$.unblockUI();
}else{
_processException(result._EXCEPTION_);
$.unblockUI();
}
}else if(result._SESSION_OUT_){ // 세션 아웃 처리
alert(result._SESSION_OUT_.message);
if(result._SESSION_OUT_.redirectUrl !=""){
$.unblockUI();
parent.location.href= redirectUrl;
}
}else{
if(callbackFunc){ // 익셉션이 아니고 callback 펑션이 있을때.
$.unblockUI();
callbackFunc(result);
}
}
}else{
if(callbackFunc){ // HTML 형식의 리턴이며 callback 펑션이 있을 때.
$.unblockUI();
callbackFunc(data);
}
}
},
beforeSend : function(){ // 로컬 이벤트, 시작
if(localStartFunc){
$.unblockUI();
localStartFunc();
}
},
complete: function(){ // 로컬 이벤트, 끝
if(localEndFunc){
$.unblockUI();
localEndFunc();
}
}
});
}
/**
* 기본 exception 처리 함수
*/
function _processException(exceptionModel){
var str = "";
if (exceptionModel.code != null && exceptionModel.code != "")
{
str = str+exceptionModel.code + "\n";
str = str+exceptionModel.obj + "\n";
str = str+exceptionModel.url + "\n";
str = str+exceptionModel.message + "\n";
}
else if (exceptionModel.message != null && exceptionModel.message != "")
{
str = str+exceptionModel.message + "\n";
}
else
{
str = str + "알수없는 오류가 발생하였습니다.";
}
alert(str);
}
/**
* Json Type Ajax Function
*
* @param url
* @param data
* @param successFn
*/
function fn_ajax_json(url, data, type, async, successFn){
$.ajax({
type: 'post',
cache: false,
url: url,
data: data,
dataType: type,
async: async,
success: successFn,
error: function() {
alert("일시적인 오류가 발생되었습니다.\n현재 페이지를 새로고침 합니다.");
location.href=location.href;
return false;
}
});
}
/*function ajaxCombo2(data,objList, sel) {
defaults = {type:'L',prgId:prgId,pId:pId};
params = $.extend(defaults, data);
ajaxCombo(params,objList, sel);
}
function ajaxCombo(data,objList, sel) {
ajaxSync(data,
function(res){
if($.isArray(objList)) {
for(var i=0;i<objList.length;i++) {
if(objList[i].containsOption("")) objList[i].removeOption(/[^0]/);
else objList[i].removeOption(/./);
}
} else {
if(objList.containsOption("")) objList.removeOption(/[^0]/);
else objList.removeOption(/./);
}
$.each(res.data, function(k,v) {
if($.isArray(objList)) {
for(var i=0;i<objList.length;i++) {
if(sel) {
if(sel==v.code) objList[i].addOption(v.code,v.value,true);
else objList[i].addOption(v.code,v.value,false);
} else {
objList[i].addOption(v.code,v.value,false);
}
}
} else {
if(sel) {
if(sel==v.code) objList.addOption(v.code,v.value,true);
else objList.addOption(v.code,v.value,false);
} else {
objList.addOption(v.code,v.value,false);
}
}
});
}
);
}
var gComboCount = 0;
var onComboSucess = null;
var onComboAllSucess = null;
function ajaxSync(data,func) {
gComboCount++;
//alert( "I:" + gComboCount);
defaults = {prgId:prgId,pId:pId};
var params = $.extend(defaults, data);
ajaxPostSync(
params.url,
params,
function(res){
gComboCount--;
//alert("O:" + gComboCount);
try {
func(res);
} catch (e) {
alert("ajaxSync:" + e);
}
if(onComboSucess!=null) onComboSucess(data,res);
if(gComboCount==0) {
if(onComboAllSucess!=null) onComboAllSucess();
}
} // end func
);
}
function ajaxPostSync(url, data, doSuccess) {
try {
$.ajax({
type: "POST",
url: url,
contentType: 'application/x-www-form-urlencoded; charset=utf-8',
data: data,
async: true,
cache: false,
success: function (response) {
try {
var rec = eval('(' + response + ')');
//var rec = eval('(' + response + ');');
doSuccess(rec,response);
if(rec.status == "ok") {
doSuccess(rec,response);
} else {
if(rec.status=="session") {
if(!isSession) {
alert(message_session_out);
top.location.href = baseUrl;
isSession = true;
}
} else {
alert("error: " + rec.message);
}
}
} catch (e) {
alert("error-2 : " + e);
alert(response);
}
},
failure: function (response) {
alert("error-1 : " + response);
}
});
} catch (e) {
alert(e);
}
}
*/
function ajaxCombo(data, objList, sel){
//alert(objList.attr("id"));
if($.isArray(objList)) {
for(var i=0;i<objList.length;i++) {
if(objList[i].containsOption("")) objList[i].removeOption(/[^0]/);
else objList[i].removeOption(/./);
}
} else {
if(objList.containsOption("")) objList.removeOption(/[^0]/);
else objList.removeOption(/./);
}
$.each(data, function(k,v) {
if($.isArray(objList)) {
for(var i=0;i<objList.length;i++) {
if(v.parentCodeName.equals("")){
if(sel) {
if(sel==v.code) objList[i].addOption(v.code,v.value,true);
else objList[i].addOption(v.code,v.value,false);
} else {
objList[i].addOption(v.code,v.value,false);
}
}
}
} else {
if(sel) {
if(sel==v.code) objList.addOption(v.code,v.value,true);
else objList.addOption(v.code,v.value,false);
} else {
objList.addOption(v.code,v.value,false);
}
}
});
}