Add an interface for checking xml

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8931 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
taggon 2011-08-29 09:19:07 +00:00
parent af48b6f406
commit de686008dd
4 changed files with 108 additions and 11 deletions

View file

@ -3,6 +3,78 @@
* @author NHN (developers@xpressengine.com)
* @brief importer에서 사용하는 javascript
**/
jQuery(function($){
// Note : Module finder is defined modules/admin/tpl/js/admin.js
// Check whether the xml file exists
$('.checkxml')
.find('input:text')
.change(function(){
$(this).closest('.checkxml').find('.desc').hide();
})
.end()
.find('button')
.click(function(){
var $this, $container, $input, $messages, $loading, $form, count;
$this = $(this).prop('disabled', true);
$form = $this.closest('form');
$container = $this.closest('.checkxml');
$input = $container.find('input').prop('disabled', true).addClass('loading');
$messages = $container.find('.desc').hide();
function on_complete(data) {
var $ul, $ttxml, $xml;
$ul = $this.closest('ul');
$xml = $ul.find('>.xml');
$ttxml = $ul.find('>.ttxml');
// when the file doesn't exists or any other error occurs
if(data.error || data.exists != 'true') {
$messages.filter('.error').fadeIn(300);
$ttxml = $ttxml.filter(':visible');
$ttxml.eq(-1).slideUp(100, function(){
$ttxml = $ttxml.slice(0,-1).eq(-1).slideUp(100,arguments.callee);
});
$form.find(':submit').attr('disabled','disabled');
return restore();
}
restore();
$messages.filter('.success').fadeIn(300);
$form.find(':submit').removeAttr('disabled');
if(data.type == 'XML') {
$ttxml = $ttxml.filter(':visible:not(.xml)');
$ttxml.eq(-1).slideUp(100, function(){
$ttxml = $ttxml.slice(0,-1).eq(-1).slideUp(100,arguments.callee);
});
if(!$xml.is(':visible')) $xml.slideDown(300);
} else if(data.type == 'TTXML') {
$ttxml = $ttxml.not(':visible');
$ttxml.eq(0).slideDown(100, function(){
$ttxml = $ttxml.slice(1).eq(0).slideDown(100,arguments.callee);
});
}
};
function restore() {
$input.prop('disabled', false).removeClass('loading');
$this.prop('disabled', false);
return false;
};
show_waiting_message = false;
$.exec_json('importer.procImporterAdminCheckXmlFile', {filename:$.trim($input.val())}, on_complete);
})
.end()
.find('.desc').hide().end()
.closest('ul').find('>li.ttxml').hide().end().end()
.closest('form').find(':submit').attr('disabled','disabled');
});
/**
* 회원정보와 게시글/댓글등의 동기화 요청 결과 처리 함수