importer 모듈을 새로운 xml migration데이터에 맞춰서 작성 완료.

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3335 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2007-12-13 13:07:45 +00:00
parent ff54da3cbd
commit d17132422e
19 changed files with 895 additions and 719 deletions

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<module version="0.1" category="accessory">
<module version="0.2" category="accessory">
<title xml:lang="ko">제로보드 데이터 이전</title>
<title xml:lang="en">Zeroboard data transferation</title>
<title xml:lang="zh-CN">数据导入</title>
<title xml:lang="jp">ZBデータ移転</title>
<title xml:lang="es">Transferencia de los datos de ZeroBoard</title>
<title xml:lang="ru">Трансферинг данных Zeroboard</title>
<author email_address="zero@zeroboard.com" link="http://www.zeroboard.com" date="2007. 2. 28">
<author email_address="zero@zeroboard.com" link="http://www.zeroboard.com" date="2007. 12. 13">
<name xml:lang="ko">제로</name>
<name xml:lang="en">Zero</name>
<name xml:lang="zh-CN">zero</name>

View file

@ -3,9 +3,8 @@
<actions>
<action name="dispImporterAdminContent" type="view" standalone="true" admin_index="true" />
<action name="procImporterAdminStep1" type="controller" standalone="true" />
<action name="procImporterAdminStep12" type="controller" standalone="true" />
<action name="procImporterAdminImport" type="controller" standalone="true" />
<action name="procImporterAdminSync" type="controller" standalone="true" />
<action name="procImporterAdminMemberImport" type="controller" standalone="true" />
<action name="procImporterAdminModuleImport" type="controller" standalone="true" />
</actions>
</module>

File diff suppressed because it is too large Load diff

View file

@ -20,7 +20,28 @@
**/
function dispImporterAdminContent() {
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('index');
$source_type = Context::get('source_type');
switch($source_type) {
case 'member' :
$template_filename = "member";
break;
case 'module' :
// 전체 모듈 목록 구함
$oModuleModel = &getModel('module');
$mid_list = $oModuleModel->getMidList();
Context::set('mid_list', $mid_list);
$template_filename = "module";
break;
case 'sync' :
$template_filename = "sync";
break;
default :
$template_filename = "index";
break;
}
$this->setTemplateFile($template_filename);
}
}

View file

@ -39,7 +39,7 @@
$lang->msg_no_xml_file = 'Could not find XML file. Please check the path again';
$lang->msg_invalid_xml_file = 'Invalid type of XML file.';
$lang->msg_importing = 'Writing %d datas of %d. (If it keeps being frozen, click the button "Continue")';
$lang->msg_import_finished = '%d datas were inputted completely. Depending on the situation, there might be some datas which couldn\'t be inputted.';
$lang->msg_import_finished = '%d/%d datas were inputted completely. Depending on the situation, there might be some datas which couldn\'t be inputted.';
$lang->msg_sync_completed = 'Completed synchronzing member article and comments.';
// blah blah..

View file

@ -39,7 +39,7 @@
$lang->msg_no_xml_file = 'No se puede encontrar el archivo XML. Verifique su ruta.';
$lang->msg_invalid_xml_file = 'Tipo de archivo XML inválido.';
$lang->msg_importing = 'Ingresando %d dotos de %d. (Si esto mantiene paralizado presione el botón "Continuar".)';
$lang->msg_import_finished = '%d datos fueron completamente ingresados. Dependiendo del caso, pueden haber algunos datos no ingresados.';
$lang->msg_import_finished = '%d/%d datos fueron completamente ingresados. Dependiendo del caso, pueden haber algunos datos no ingresados.';
$lang->msg_sync_completed = 'Sincronización del usuario, artículo y respuestas finalizadas.';
// bla bla...

View file

@ -39,7 +39,7 @@
$lang->msg_no_xml_file = 'XMLファイルが見つかりません。パスをもう一度確認してください。';
$lang->msg_invalid_xml_file = 'XMLファイルのフォーマットが正しくありません。';
$lang->msg_importing = '%d個のデータの内、%d個を変換中です止まったままの場合は「続ける」ボタンをクリックしてください。';
$lang->msg_import_finished = '%d個のデータ変換が完了しました。場合によって変換されていないデータがあることもあります。';
$lang->msg_import_finished = '%d/%d個のデータ変換が完了しました。場合によって変換されていないデータがあることもあります。';
$lang->msg_sync_completed = '会員情報、書き込みデータ、コメントのデータの同期化(変換)が完了しました。';
// Bla, Blah..

View file

@ -39,7 +39,7 @@
$lang->msg_no_xml_file = 'XML파일을 찾을 수 없습니다. 경로를 다시 확인해주세요';
$lang->msg_invalid_xml_file = '잘못된 형식의 XML파일입니다';
$lang->msg_importing = '%d개의 데이터중 %d개를 입력중입니다. (계속 멈추어 있으면 "계속진행" 버튼을 클릭해주세요)';
$lang->msg_import_finished = '%d개의 데이터 입력이 완료되었습니다. 상황에 따라 입력되지 못한 데이터가 있을 수 있습니다.';
$lang->msg_import_finished = '%d/%d 개의 데이터 입력이 완료되었습니다. 상황에 따라 입력되지 못한 데이터가 있을 수 있습니다.';
$lang->msg_sync_completed = '회원과 게시물, 댓글의 동기화가 완료되었습니다.';
// 주절 주절..

View file

@ -39,7 +39,7 @@
$lang->msg_no_xml_file = 'XML файл не найден. Пожалуйста, проверьте путь еще раз';
$lang->msg_invalid_xml_file = 'Неверный тип XML файла.';
$lang->msg_importing = 'Пишем %d данные %d. (Если процесс "завис", нажмите кнопку "Продолжить")';
$lang->msg_import_finished = '%d данные были поностью импортированы. В зависимости от ситуации, некоторые данные могут не быть импортированы.';
$lang->msg_import_finished = '%d/%d данные были поностью импортированы. В зависимости от ситуации, некоторые данные могут не быть импортированы.';
$lang->msg_sync_completed = 'Выполнена синхронизация пользователей, статей и комментариев.';
// blah blah.. чепуха)

View file

@ -39,7 +39,7 @@
$lang->msg_no_xml_file = '找不到XML文件请重新确认路径。';
$lang->msg_invalid_xml_file = '错误形式的XML文件';
$lang->msg_importing = '%d个的数据中正在输入 %d个。 (长时间没有响应时请按“继续进行”按钮)';
$lang->msg_import_finished = '已完成输入%d个数据。根据情况的不同可能有没有被导入的数据。';
$lang->msg_import_finished = '已完成输入%d/%d个数据。根据情况的不同可能有没有被导入的数据。';
$lang->msg_sync_completed = '已完成会员和文章,评论的同步。';
// 说明

View file

@ -1,14 +0,0 @@
<filter name="import_xml" module="importer" act="procImporterAdminImport">
<form>
<node target="xml_file" required="true" />
</form>
<parameter />
<response callback_func="completeImport">
<tag name="error" />
<tag name="message" />
<tag name="is_finished" />
<tag name="position" />
<tag name="file_point" />
<tag name="total_count" />
</response>
</filter>

View file

@ -1,13 +0,0 @@
<filter name="step12" module="importer" act="procImporterAdminStep12">
<form>
<node target="target_module" required="true" />
<node target="target_path" required="true" />
</form>
<parameter />
<response callback_func="completeStep12">
<tag name="error" />
<tag name="message" />
<tag name="next_step" />
<tag name="category_list" />
</response>
</filter>

View file

@ -1,8 +1,5 @@
<!--%import("js/importer_admin.js")-->
<!--%import("css/importer.js")-->
<!--%import("filter/step1.xml")-->
<!--%import("filter/step12.xml")-->
<!--%import("filter/import_xml.xml")-->
<!--%import("css/importer.css")-->
<h3>{$lang->importer} <span class="gray">{$lang->cmd_management}</span></h3>
@ -11,22 +8,24 @@
<!-- step 1. import하려는 XML파일의 성격 및 대상 모듈을 지정 -->
<div id="step1">
<form action="./" method="get" onsubmit="return procFilter(this, step1);">
<form action="./" method="get">
<input type="hidden" name="module" value="{$module}" />
<input type="hidden" name="act" value="{$act}" />
<table cellspacing="0" class="adminTable">
<col width="150" />
<col />
<caption>{$lang->import_step_title[1]} - {$lang->import_step_desc[1]}</caption>
<tr>
<th scope="col"><label for="source_type_module">{$lang->type_module}</label></th>
<td class="left"><input type="radio" name="source_type" value="module" id="source_type_module" /> {$lang->about_type_module}</td>
<td class="left"><input type="radio" name="source_type" value="module" id="source_type_module" /> <label for="source_type_module">{$lang->about_type_module}</label></td>
</tr>
<tr>
<th scope="col"><label for="source_type_member">{$lang->type_member}</label></th>
<td class="left"><input type="radio" name="source_type" value="member" id="source_type_member" /> {$lang->about_type_member}</td>
<td class="left"><input type="radio" name="source_type" value="member" id="source_type_member" /> <label for="source_type_member">{$lang->about_type_member}</label></td>
</tr>
<tr>
<th scope="col"><label for="source_type_syncmember">{$lang->type_syncmember}</label></th>
<td class="left"><input type="radio" name="source_type" value="syncmember" id="source_type_syncmember" /> {$lang->about_type_syncmember}</td>
<td class="left"><input type="radio" name="source_type" value="sync" id="source_type_syncmember" /> <label for="source_type_syncmember">{$lang->about_type_syncmember}</label></td>
</tr>
<tr>
<th scope="row" colspan="2" class="button">
@ -37,98 +36,3 @@
</form>
</div>
<!-- step 1-2. 대상이 게시물 정보일 경우 대상 모듈 목록을 선택하도록 함 -->
<div id="step12" style="display:none">
<form action="./" method="get" onsubmit="return procFilter(this, step12);">
<table cellspacing="0" class="adminTable">
<caption>{$lang->import_step_title[12]} - {$lang->import_step_desc[12]}</caption>
<tr>
<td><select name="target_module" id="target_module"></select></td>
</tr>
</table>
<table cellspacing="0" class="adminTable">
<col width="150" />
<col />
<caption>{nl2br($lang->about_target_path)}</caption>
<tr>
<th>Path/URL</th>
<td><input type="text" name="target_path" id="target_path" class="inputTypeText w400" /></td>
</tr>
<tr>
<th scope="row" colspan="2" class="button">
<span class="button"><input type="submit" value="{$lang->cmd_next}" /></span>
</th>
</tr>
</table>
</form>
</div>
<!-- step 1-3. 대상이 게시물 정보일 경우 모듈 선택후 분류가 있으면 분류 선택을 하도록 함 -->
<div id="step13" style="display:none">
<form action="./" method="get" onsubmit="return doStep13(this)">
<table cellspacing="0" class="adminTable">
<caption>{$lang->import_step_title[13]} - {$lang->import_step_desc[13]}</caption>
<tr>
<td><select name="target_category" id="target_category"><option value=""></option></select></td>
</tr>
<tr>
<th class="button"><span class="button"><input type="submit" value="{$lang->cmd_next}" /></span></th>
</tr>
</table>
</form>
</div>
<!-- step 2. XML 파일 지정 -->
<div id="step2" style="display:none">
<form action="./" method="get" onsubmit="return doStep2(this)" id="fo_step2">
<input type="hidden" name="module_srl" value="" />
<input type="hidden" name="target_path" value="" />
<input type="hidden" name="category_srl" value="" />
<input type="hidden" name="position" value="0" />
<input type="hidden" name="file_point" value="0" />
<input type="hidden" name="total_count" value="0" />
<table cellspacing="0" class="adminTable">
<caption>{$lang->import_step_title[2]} - {$lang->import_step_desc[2]}</caption>
<tr>
<td>
<input type="text" name="xml_file" value="./" class="inputTypeText w400" />
</td>
</tr>
<tr>
<th class="button"><span class="button"><input type="submit" value="{$lang->cmd_next}" /></span></th>
</tr>
</table>
<div id="step2_status" style="display:none;" class="gap1">
<table border="0" cellspacing="0" cellpadding="0" width="100%" style="margin-bottom:10px;">
<col />
<col width="120" />
<tr>
<td><div id="bar" style="width:1px;height:10px;background-color:#EFEFEF;border:1px solid #888888"></div></td>
<td class="tRight"><span id="bar_status"></span>
</tr>
</table>
<div id="step2_position" style="height:100px;overflow-y:scroll;border:2px solid #DDDDDD;padding:10px;" class="desc"></div>
<div class="tRight gap1">
<span class="button"><input type="button" value="{$lang->cmd_continue}" onclick="doManualProcess(); return false" /></span>
</div>
</div>
</form>
</div>
<!-- step 3. 회원 동기화 시작 버튼 -->
<div id="step3" style="display:none">
<form action="./" method="get" onsubmit="return doStep3(this)">
<table cellspacing="0" class="adminTable">
<caption>{$lang->import_step_title[3]} - {$lang->import_step_desc[3]}</caption>
<tr>
<th class="button"><span class="button"><input type="submit" value="{$lang->cmd_sync_member}" /></span></th>
</tr>
</table>
</form>
</div>
<!-- final step. 진행 완료 또는 실패 메세지 -->
<div id="step_finish" style="display:none;"></div>

View file

@ -3,135 +3,106 @@
* @author zero (zero@nzeo.com)
* @brief importer에서 사용하는 javascript
**/
/* Step 1 처리 */
function completeStep1(ret_obj) {
var error = ret_obj['error'];
var message = ret_obj['message'];
var next_step = ret_obj['next_step'];
var module_list = ret_obj['module_list'];
if(module_list) {
var sel = xGetElementById("target_module");
var module_list_arr = module_list.split("\n");
for(var i=0;i<module_list_arr.length;i++) {
var pos = module_list_arr[i].indexOf(',');
var value = module_list_arr[i].substr(0,pos);
var text = module_list_arr[i].substr(pos+1);
var opt_obj = new Option(text, value, true, true);
sel.options[sel.options.length] = opt_obj;
}
sel.selectedIndex = 0;
}
xGetElementById('step1').style.display = 'none';
xGetElementById('step'+next_step).style.display = 'block';
}
/* Step 1-2 모듈선택 처리 (카테고리 있으면 카테고리 선택으로, 아니면 바로 파일 업로드로) */
function completeStep12(ret_obj) {
var error = ret_obj['error'];
var message = ret_obj['message'];
var next_step = ret_obj['next_step'];
var category_list = ret_obj['category_list'];
if(category_list) {
var sel = xGetElementById("target_category");
var category_list_arr = category_list.split("\n");
for(var i=0;i<category_list_arr.length;i++) {
var pos = category_list_arr[i].indexOf(',');
var value = category_list_arr[i].substr(0,pos);
var text = category_list_arr[i].substr(pos+1);
var opt_obj = new Option(text, value, true, true);
sel.options[sel.options.length] = opt_obj;
}
sel.selectedIndex = 0;
}
xGetElementById('step12').style.display = 'none';
xGetElementById('step'+next_step).style.display = 'block';
}
/* Step 1-3 카테고리 선택후 파일 업로드 보여주기 */
function doStep13(fo_obj) {
xGetElementById('step13').style.display = 'none';
xGetElementById('step2').style.display = 'block';
return false;
}
/* Step 2 XML파일을 입력받아서 처리~ */
function doStep2(fo_obj) {
var sel_module = xGetElementById("target_module");
if(sel_module.options.length>0) {
var module_srl = sel_module.options[sel_module.selectedIndex].value;
fo_obj.module_srl.value = module_srl;
}
var sel_category = xGetElementById("target_category");
if(sel_category.options.length>1) {
var category_srl = sel_category.options[sel_category.selectedIndex].value;
fo_obj.category_srl.value = category_srl;
}
var target_path = xGetElementById("target_path").value;
fo_obj.target_path.value = target_path;
procFilter(fo_obj, import_xml);
xGetElementById('step2_status').style.display = 'block';
return false;
}
/* Step Complete Import */
function completeImport(ret_obj) {
var message = ret_obj['message'];
var is_finished = ret_obj['is_finished'];
var position = ret_obj['position'];
var file_point = ret_obj['file_point'];
var total_count = ret_obj['total_count'];
if(total_count>0) {
var bar = xGetElementById('bar');
var status = xGetElementById('bar_status');
var per = parseInt(position/total_count*100,10)
xInnerHtml(status, position+'/'+total_count+' ('+per+'%)');
bar.style.width = per+'%';
}
if(is_finished=='Y') {
alert(ret_obj["message"]);
location.href = location.href;
} else {
var fo_obj = xGetElementById('fo_step2');
fo_obj.position.value = position;
fo_obj.file_point.value = file_point;
fo_obj.total_count.value = total_count;
message = message.replace(/&lt;/g,"<").replace(/&gt;/g,">");
var obj = xGetElementById('step2_position');
var txt = xInnerHtml(obj);
if(txt.length > 1024*10) txt = '';
if(message != "success") xInnerHtml(obj, txt+message);
obj.scrollTop += xHeight(obj);
procFilter(fo_obj, import_xml);
}
}
function doManualProcess() {
var fo_obj = xGetElementById('fo_step2');
procFilter(fo_obj, import_xml);
}
/* 회원정보와 게시물의 싱크 */
function doStep3(fo_obj) {
exec_xml('importer','procImporterAdminSync', new Array(), completeStep3);
function doSync(fo_obj) {
exec_xml('importer','procImporterAdminSync', new Array(), completeSync);
return false;
}
function completeStep3(ret_obj) {
function completeSync(ret_obj) {
alert(ret_obj['message']);
location.href=location.href;
}
/* 회원정보 데이터 import */
function doImportMember(fo_obj) {
var xml_file = fo_obj.xml_file.value;
if(!xml_file) return false;
var params = new Array();
params['xml_file'] = xml_file;
params['total_count'] = fo_obj.total_count.value;
params['success_count'] = fo_obj.success_count.value;
params['readed_line'] = fo_obj.readed_line.value;
var response_tags = new Array("error","message", "total_count", "success_count", "readed_line", "is_finished");
fo_obj.xml_file.disabled = true;
xGetElementById("status").style.display = "block";
xGetElementById("status_button_prev").style.display = "none";
xGetElementById("status_button").style.display = "block";
exec_xml('importer','procImporterAdminMemberImport', params, completeImportMember, response_tags);
return false;
}
function completeImportMember(ret_obj) {
var total_count = ret_obj['total_count'];
var success_count = ret_obj['success_count'];
var readed_line = ret_obj['readed_line'];
var is_finished = ret_obj['is_finished'];
if(is_finished == '1') {
alert(ret_obj['message']);
xInnerHtml("status", ret_obj['message']);
} else {
xInnerHtml("status", ret_obj['message']);
var fo_obj = xGetElementById("fo_import");
fo_obj.total_count.value = total_count;
fo_obj.success_count.value = success_count;
fo_obj.readed_line.value = readed_line;
doImportMember(fo_obj);
}
}
/* 모듈 데이터 import */
function doImportModule(fo_obj) {
var target_module = fo_obj.target_module.options[fo_obj.target_module.selectedIndex].value;
if(!target_module) return false;
var xml_file = fo_obj.xml_file.value;
if(!xml_file) return false;
var params = new Array();
params['xml_file'] = xml_file;
params['target_module'] = target_module;
params['total_count'] = fo_obj.total_count.value;
params['success_count'] = fo_obj.success_count.value;
params['readed_line'] = fo_obj.readed_line.value;
var response_tags = new Array("error","message", "total_count", "success_count", "readed_line", "is_finished");
fo_obj.target_module.disabled = true;
fo_obj.xml_file.disabled = true;
xGetElementById("status").style.display = "block";
xGetElementById("status_button_prev").style.display = "none";
xGetElementById("status_button").style.display = "block";
exec_xml('importer','procImporterAdminModuleImport', params, completeImportModule, response_tags);
return false;
}
function completeImportModule(ret_obj, response_tags) {
var total_count = ret_obj['total_count'];
var success_count = ret_obj['success_count'];
var readed_line = ret_obj['readed_line'];
var is_finished = ret_obj['is_finished'];
if(is_finished == '1') {
alert(ret_obj['message']);
xInnerHtml("status", ret_obj['message']);
} else {
xInnerHtml("status", ret_obj['message']);
var fo_obj = xGetElementById("fo_import");
fo_obj.total_count.value = total_count;
fo_obj.success_count.value = success_count;
fo_obj.readed_line.value = readed_line;
doImportModule(fo_obj);
}
}

View file

@ -0,0 +1,33 @@
<!--%import("js/importer_admin.js")-->
<!--%import("css/importer.css")-->
<h3>{$lang->importer} <span class="gray">{$lang->cmd_management}</span></h3>
<div class="infoText">{nl2br($lang->about_importer)}</div>
<div>
<form action="./" method="get" onsubmit="return doImportMember(this)" id="fo_import">
<input type="hidden" name="total_count" value="0" />
<input type="hidden" name="success_count" value="0" />
<input type="hidden" name="readed_line" value="0" />
<table cellspacing="0" class="adminTable">
<caption>{$lang->import_step_title[2]} - {$lang->import_step_desc[2]}</caption>
<tr>
<td>
<input type="text" name="xml_file" value="./" class="inputTypeText w400" />
<p>ex1) ../member.xml</p>
<p>ex2) http://...../member.xml</p>
</td>
</tr>
<tr>
<th class="button">
<div id="status_button_prev"><span class="button"><input type="submit" value="{$lang->cmd_next}" /></span></div>
<div id="status_button" style="display:none"><span class="button"><input type="submit" value="{$lang->cmd_continue}" /></span></div>
</th>
</tr>
</table>
<div id="status" style="display:none"></div>
</form>
</div>

View file

@ -0,0 +1,51 @@
<!--%import("js/importer_admin.js")-->
<!--%import("css/importer.css")-->
<h3>{$lang->importer} <span class="gray">{$lang->cmd_management}</span></h3>
<!-- 설명 -->
<div class="infoText">{nl2br($lang->about_importer)}</div>
<!-- step 1-2. 대상이 게시물 정보일 경우 대상 모듈 목록을 선택하도록 함 -->
<div>
<form action="./" method="get" onsubmit="return doImportModule(this)" id="fo_import">
<input type="hidden" name="total_count" value="0" />
<input type="hidden" name="success_count" value="0" />
<input type="hidden" name="readed_line" value="0" />
<table cellspacing="0" class="adminTable">
<caption>{$lang->import_step_title[1]} - {$lang->import_step_desc[12]}</caption>
<tr>
<td>
<select name="target_module">
<option value="">====================</option>
<!--@foreach($mid_list as $key => $val)-->
<option value="{$val->module_srl}">{$val->browser_title}</option>
<!--@end-->
</select>
</td>
</tr>
</table>
<table cellspacing="0" class="adminTable">
<caption>{$lang->import_step_title[2]} - {$lang->import_step_desc[2]}</caption>
<tr>
<td>
<input type="text" name="xml_file" value="./" class="inputTypeText w400" />
<p>ex1) ../member.xml</p>
<p>ex2) http://...../member.xml</p>
</td>
</tr>
<tr>
<th class="button">
<div id="status_button_prev"><span class="button"><input type="submit" value="{$lang->cmd_next}" /></span></div>
<div id="status_button" style="display:none"><span class="button"><input type="submit" value="{$lang->cmd_continue}" /></span></div>
</th>
</tr>
</table>
<div id="status" style="display:none"></div>
</form>
</div>

View file

@ -0,0 +1,16 @@
<!--%import("js/importer_admin.js")-->
<!--%import("css/importer.css")-->
<h3>{$lang->importer} <span class="gray">{$lang->cmd_management}</span></h3>
<!-- 설명 -->
<div class="infoText">{nl2br($lang->about_importer)}</div>
<form action="./" method="get" onsubmit="return doSync(this)">
<table cellspacing="0" class="adminTable">
<caption>{$lang->import_step_title[3]} - {$lang->import_step_desc[3]}</caption>
<tr>
<td><span class="button"><input type="submit" value="{$lang->cmd_sync_member}" /></span></td>
</tr>
</table>
</form>