Improve backward compatibility with AXUpload5 and other third-party AJAX apps

This commit is contained in:
Kijin Sung 2016-01-26 10:32:59 +09:00
parent 8ee5e8c4b0
commit 3a419d586d
5 changed files with 33 additions and 15 deletions

View file

@ -299,7 +299,9 @@
$.exec_json('file.getFileList', obj, function(res){
data.uploadTargetSrl = res.upload_target_srl;
editorRelKeys[data.editorSequence].primary.value = res.upload_target_srl;
if(editorRelKeys[data.editorSequence]) {
editorRelKeys[data.editorSequence].primary.value = res.upload_target_srl;
}
data.uploadTargetSrl = res.uploadTargetSrl;
// @TODO 정리

View file

@ -239,21 +239,23 @@ function xml2json(xml, tab, ignoreAttrib) {
// 전송 성공시
function onsuccess(data, textStatus, xhr) {
waiting_obj.css('display', 'none').trigger('cancel_confirm');
var ret = [];
var tags = {};
var ret = {};
$.each(response_tags, function(key, val){ tags[val] = true; });
tags.redirect_url = true;
tags.act = true;
$.each(data, function(key, val){ if(tags[key]) ret[key] = val; });
if(ret.error != '0') {
if ($.isFunction($.exec_xml.onerror)) {
return $.exec_xml.onerror(module, act, ret, callback_func, response_tags, callback_func_arg, fo_obj);
$.each(data, function(key, val) {
if(key == "act" || key == "redirect_url" || $.inArray(key, response_tags)) {
if($.isArray(val)) {
ret[key] = { item: val };
} else {
ret[key] = val;
}
}
});
alert( (ret.message || 'An unknown error occured while loading ['+module+'.'+act+']').replace(/\\n/g, '\n') );
if(data.error != 0) {
if ($.isFunction($.exec_xml.onerror)) {
return $.exec_xml.onerror(module, act, data, callback_func, response_tags, callback_func_arg, fo_obj);
}
alert( (data.message || 'An unknown error occured while loading ['+module+'.'+act+']').replace(/\\n/g, '\n') );
return null;
}