mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
issue 70 data import developement.
but not yet complete at processbar git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8979 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
3503f2aeb8
commit
69ec09e2b8
3 changed files with 85 additions and 77 deletions
|
|
@ -4,9 +4,25 @@
|
|||
<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
|
||||
<p>{$XE_VALIDATOR_MESSAGE}</p>
|
||||
</div>
|
||||
<form action="./" class="form" method="get" onsubmit="return doPreProcessing(this)" id="moduleImportForm">
|
||||
|
||||
<!-- process 진행 상황 -->
|
||||
<div id="process" style="display:none;">
|
||||
<form action="./" method="get" onsubmit="return doImport()" id="fo_process">
|
||||
<input type="hidden" name="type" value="" />
|
||||
<input type="hidden" name="total" value="" />
|
||||
<input type="hidden" name="cur" value="" />
|
||||
<input type="hidden" name="key" value="" />
|
||||
<input type="hidden" name="target_module" value="" />
|
||||
<input type="hidden" name="guestbook_target_module" value="" />
|
||||
<input type="hidden" name="unit_count" value="100" />
|
||||
<input type="hidden" name="user_id" value="" />
|
||||
</form>
|
||||
</div>
|
||||
<!--// process 진행상황 끝 -->
|
||||
|
||||
<form action="./" class="form" method="get" onsubmit="return doPreProcessing(this, 'documentForm')" id="documentForm">
|
||||
<input type="hidden" name="act" value="" />
|
||||
<input type="hidden" name="type" value="module" />
|
||||
<input type="hidden" name="target_module" value="" id="target_module" />
|
||||
<h2 class="h2">{$lang->type_module}</h2>
|
||||
<ul>
|
||||
<li>
|
||||
|
|
@ -32,7 +48,7 @@
|
|||
</select>
|
||||
</p>
|
||||
<p class="a">
|
||||
<select class="moduleIdList" style="width:290px">
|
||||
<select class="moduleIdList" style="width:290px" name="target_module">
|
||||
<option>{$lang->select_module_id}</option>
|
||||
</select>
|
||||
</p>
|
||||
|
|
@ -42,17 +58,16 @@
|
|||
<div class="a">
|
||||
<input type="text" name="site_keyword" /> <a href="#suggestion3" class="tgAnchor findsite">{$lang->find_site}</a>
|
||||
<div id="suggestion3" class="tgContent suggestion">
|
||||
<ul>
|
||||
</ul>
|
||||
<ul></ul>
|
||||
</div>
|
||||
</div>
|
||||
<p class="a">
|
||||
<select style="width:290px">
|
||||
<option>{$lang->select_module_id}</option>
|
||||
<select class="moduleList" style="width:290px">
|
||||
<option>{$lang->select_module}</option>
|
||||
</select>
|
||||
</p>
|
||||
<p class="a">
|
||||
<select style="width:290px">
|
||||
<select class="moduleIdList" style="width:290px" name="guestbook_target_module">
|
||||
<option>{$lang->select_module_id}</option>
|
||||
</select>
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -52,11 +52,13 @@ $('.checkxml')
|
|||
$ttxml = $ttxml.slice(0,-1).eq(-1).slideUp(100,arguments.callee);
|
||||
});
|
||||
if(!$xml.is(':visible')) $xml.slideDown(300);
|
||||
$form.find('input[name=type]').val('module');
|
||||
} 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);
|
||||
});
|
||||
$form.find('input[name=type]').val('ttxml');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -95,7 +97,7 @@ function doSync(fo_obj) {
|
|||
/**
|
||||
* xml파일을 DB입력전에 extract를 통해 분할 캐싱을 요청하는 함수
|
||||
**/
|
||||
function doPreProcessing(form) {
|
||||
function doPreProcessing(form, formId) {
|
||||
var xml_file, type, resp, prepared = false, $ = jQuery, $status, $process, $form;
|
||||
|
||||
xml_file = form.elements['xml_file'].value;
|
||||
|
|
@ -103,63 +105,9 @@ function doPreProcessing(form) {
|
|||
|
||||
if(!xml_file) return false;
|
||||
|
||||
$form = $('#importForm').hide();
|
||||
$process = $('#process').show();
|
||||
$status = $('#status').empty();
|
||||
|
||||
// display dots while preparing
|
||||
(function(){
|
||||
if(prepared) return;
|
||||
|
||||
var str = $status.html();
|
||||
(!str.length || str.length - preProcessingMsg.length > 50)?str=preProcessingMsg:str+='.';
|
||||
|
||||
$status.html(str);
|
||||
|
||||
setTimeout(arguments.callee, 50);
|
||||
})();
|
||||
|
||||
setTimeout(doPrepareDot, 50);
|
||||
|
||||
function on_complete(ret) {
|
||||
var $reload, $cont, fo_proc, fo_import, elems, i, c, key, to_copy;
|
||||
|
||||
prepared = true;
|
||||
$status.empty();
|
||||
|
||||
$reload = $('#btn_reload');
|
||||
$cont = $('#btn_continue');
|
||||
|
||||
if(ret.status == -1) {
|
||||
$form.show();
|
||||
$reload.show();
|
||||
$process.hide();
|
||||
$cont.hide();
|
||||
return alert(ret.message);
|
||||
}
|
||||
|
||||
$reload.hide();
|
||||
$cont.show();
|
||||
|
||||
fo_proc = get_by_id('fo_process');
|
||||
elems = fo_proc.elements;
|
||||
|
||||
for(i=0,c=resp.length; i < c; i++) {
|
||||
key = resp[i];
|
||||
elems[key]?elems[key].value=ret[key]:0;
|
||||
}
|
||||
|
||||
fo_import = get_by_id('fo_import');
|
||||
if(fo_import) {
|
||||
to_copy = ['target_module','guestbook_target_module','user_id', 'unit_count'];
|
||||
for(i=0,c=to_copy.length; i < c; i++) {
|
||||
key = to_copy[i];
|
||||
if(fo_import.elements[key]) fo_proc.elements[key].value = fo_import.elements[key].value;
|
||||
}
|
||||
}
|
||||
|
||||
doImport();
|
||||
}
|
||||
//$form = $('#importForm').hide();
|
||||
//$process = $('#process').show();
|
||||
//$status = $('#status').empty();
|
||||
|
||||
exec_xml(
|
||||
'importer', // module
|
||||
|
|
@ -169,39 +117,73 @@ function doPreProcessing(form) {
|
|||
resp=['error','message','type','total','cur','key','status'] // response tags
|
||||
);
|
||||
|
||||
function on_complete(ret) {
|
||||
var $reload, $cont, fo_proc, elems, i, c, key, to_copy;
|
||||
|
||||
prepared = true;
|
||||
|
||||
// when fail prepare
|
||||
if(ret.status == -1) {
|
||||
return alert(ret.message);
|
||||
}
|
||||
|
||||
fo_proc = get_by_id('fo_process');
|
||||
elems = fo_proc.elements;
|
||||
|
||||
for(i=0,c=resp.length; i < c; i++) {
|
||||
key = resp[i];
|
||||
elems[key]?elems[key].value=ret[key]:0;
|
||||
}
|
||||
|
||||
fo_import = get_by_id(formId);
|
||||
if(fo_import) {
|
||||
to_copy = ['target_module','guestbook_target_module','user_id', 'unit_count'];
|
||||
for(i=0,c=to_copy.length; i < c; i++) {
|
||||
key = to_copy[i];
|
||||
if(fo_import.elements[key]) fo_proc.elements[key].value = fo_import.elements[key].value;
|
||||
}
|
||||
}
|
||||
|
||||
doImport(formId);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* @brief Start importing */
|
||||
function doImport() {
|
||||
function doImport(formId) {
|
||||
var form = get_by_id('fo_process'), elems = form.elements, i, c, params={}, resp;
|
||||
console.log(elems);
|
||||
|
||||
for(i=0,c=elems.length; i < c; i++) {
|
||||
params[elems[i].name] = elems[i].value;
|
||||
}
|
||||
|
||||
displayProgress(params.total, params.cur);
|
||||
//displayProgress(params.total, params.cur);
|
||||
|
||||
function on_complete(ret, response_tags) {
|
||||
console.log(ret);
|
||||
var i, c, key;
|
||||
|
||||
for(i=0,c=resp.length; i < c; i++) {
|
||||
key = resp[i];
|
||||
elems[key]?elems[key].value=ret_obj[key]:0;
|
||||
//elems[key]?elems[key].value=ret_obj[key]:0;
|
||||
elems[key]?elems[key].value=ret[key]:0;
|
||||
}
|
||||
|
||||
ret.total = parseInt(ret.total, 10) || 0;
|
||||
ret.cur = parseInt(ret.cur, 10) || 0;
|
||||
|
||||
if(ret.total > ret.cur) {
|
||||
doImport();
|
||||
doImport(formId);
|
||||
} else {
|
||||
alert('성공입니까?');
|
||||
alert(ret.message);
|
||||
try {
|
||||
form.reset();
|
||||
get_by_id('fo_import').reset();
|
||||
jQuery('#process').hide();
|
||||
jQuery('#importForm').show();
|
||||
get_by_id(formId).reset();
|
||||
//jQuery('#process').hide();
|
||||
//jQuery('#importForm').show();
|
||||
} catch(e){};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue