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

@ -13,6 +13,7 @@
<action name="procImporterAdminMessageImport" type="controller" standalone="true" />
<action name="procImporterAdminModuleImport" type="controller" standalone="true" />
<action name="procImporterAdminTTXMLImport" type="controller" standalone="true" />
<action name="procImporterAdminCheckXmlFile" type="controller" standalone="true" />
</actions>
<menus>
<menu name="importer">

View file

@ -19,6 +19,19 @@
function init() {
}
/**
* @brief Check whether the passing filename exists or not. Detect the file type, too.
*/
function procImporterAdminCheckXmlFile() {
$filename = Context::get('filename');
// TODO : when it success
$this->add('exists', 'true');
$this->add('type', 'XML'); // or TTXML
// return new Object(-1, 'error');
}
/**
* @brief sync member information with document information
**/
@ -936,5 +949,6 @@
}
return $extra_vars;
}
}
?>

View file

@ -11,14 +11,14 @@
<ul>
<li>
<p class="q">{$lang->xml_path} {$lang->path_info}</p>
<p class="a">
<p class="a checkxml">
<input type="text" name="xml_file" value="./" />
<button type="button">경로 확인</button>
<em class="desc">XML 파일의 경로가 올바르지 않습니다.</em>
<em class="desc">XML 파일의 경로가 바르게 설정되었습니다.</em>
<em class="desc error">아이쿠! XML 파일이 설정한 경로에 없네요.</em>
<em class="desc success">성공! XML 파일이 요기잉네?</em>
</p>
</li>
<li>
<li class="xml ttxml">
<p class="q">{$lang->data_destination}</p>
<div class="a">
<input type="text" name="site_keyword" /> <a href="#suggestion1" class="tgAnchor findsite">{$lang->find_site}</a>
@ -28,17 +28,17 @@
</div>
</div>
<p class="a">
<select class="moduleList" style="width:290px">
<select id="moduleList" class="moduleList" style="width:290px">
<option>{$lang->select_module}</option>
</select>
</p>
<p class="a">
<select style="width:290px">
<select id="moduleIdList" style="width:290px">
<option>{$lang->select_module_id}</option>
</select>
</p>
</li>
<li>
<li class="ttxml">
<p class="q">{$lang->guestbook_destination}</p>
<div class="a">
<input type="text" name="site_keyword" /> <a href="#suggestion3" class="tgAnchor findsite">{$lang->find_site}</a>
@ -53,13 +53,13 @@
</select>
</p>
</li>
<li>
<li class="ttxml">
<p class="q">{$lang->about_ttxml_user_id}</p>
<p class="a"><input type="text" name="user_id" value="{$logged_info->user_id}" /></p>
</li>
</ul>
<div class="btnArea">
<span class="btn"><input type="submit" value="{$lang->importer}" disabled="disabled" /></span>
<span class="btn"><input type="submit" value="{$lang->importer}" /></span>
</div>
</form>
<form action="./" class="form" method="get" onsubmit="return doPreProcessing(this)" id="fo_import">
@ -68,7 +68,12 @@
<ul>
<li>
<p class="q">{$lang->xml_path} {$lang->path_info}</p>
<p class="a"><input type="text" name="xml_file" value="./" /></p>
<p class="a checkxml">
<input type="text" name="xml_file" value="./" />
<button type="button">경로 확인</button>
<em class="desc error">아이쿠! XML 파일이 설정한 경로에 없네요.</em>
<em class="desc success">성공! XML 파일이 요기잉네?</em>
</p>
</li>
</ul>
<div class="btnArea">
@ -81,7 +86,12 @@
<ul>
<li>
<p class="q">{$lang->xml_path} {$lang->path_info}</p>
<p class="a"><input type="text" name="xml_file" value="./" /></p>
<p class="a checkxml">
<input type="text" name="xml_file" value="./" />
<button type="button">경로 확인</button>
<em class="desc error">아이쿠! XML 파일이 설정한 경로에 없네요.</em>
<em class="desc success">성공! XML 파일이 요기잉네?</em>
</p>
</li>
</ul>
<div class="btnArea">

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');
});
/**
* 회원정보와 게시글/댓글등의 동기화 요청 결과 처리 함수