mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-27 23:29:57 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@1423 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
6503a6d593
commit
469bd4da53
6 changed files with 53 additions and 9 deletions
|
|
@ -29,7 +29,7 @@
|
||||||
$this->page_count = $page_count;
|
$this->page_count = $page_count;
|
||||||
$this->point = 0;
|
$this->point = 0;
|
||||||
|
|
||||||
$first_page = $cur_page-(int)($page_count/2);
|
$first_page = $cur_page - (int)($page_count/2);
|
||||||
if($first_page<1) $first_page = 1;
|
if($first_page<1) $first_page = 1;
|
||||||
$last_page = $total_page;
|
$last_page = $total_page;
|
||||||
if($last_page>$total_page) $last_page = $total_page;
|
if($last_page>$total_page) $last_page = $total_page;
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
**/
|
**/
|
||||||
function getNextPage() {
|
function getNextPage() {
|
||||||
$page = $this->first_page+$this->point++;
|
$page = $this->first_page+$this->point++;
|
||||||
if($page > $this->last_page) $page = 0;
|
if($this->point > $this->page_count) $page = 0;
|
||||||
return $page;
|
return $page;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,9 @@
|
||||||
var $oMemberController = null;
|
var $oMemberController = null;
|
||||||
var $oDocumentController = null;
|
var $oDocumentController = null;
|
||||||
|
|
||||||
|
var $position = 0;
|
||||||
var $imported_count = 0;
|
var $imported_count = 0;
|
||||||
|
var $limit_count = 500;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief 초기화
|
||||||
|
|
@ -94,6 +96,7 @@
|
||||||
$module_srl = Context::get('module_srl');
|
$module_srl = Context::get('module_srl');
|
||||||
$category_srl = Context::get('category_list');
|
$category_srl = Context::get('category_list');
|
||||||
$xml_file = Context::get('xml_file');
|
$xml_file = Context::get('xml_file');
|
||||||
|
$this->position = (int)Context::get('position');
|
||||||
|
|
||||||
// 파일을 찾을 수 없으면 에러 표시
|
// 파일을 찾을 수 없으면 에러 표시
|
||||||
if(!file_exists($xml_file)) return new Object(-1,'msg_no_xml_file');
|
if(!file_exists($xml_file)) return new Object(-1,'msg_no_xml_file');
|
||||||
|
|
@ -104,7 +107,13 @@
|
||||||
if($module_srl) $this->importModule($xml_file, $module_srl, $category_srl);
|
if($module_srl) $this->importModule($xml_file, $module_srl, $category_srl);
|
||||||
else $this->importMember($xml_file);
|
else $this->importMember($xml_file);
|
||||||
|
|
||||||
$this->setMessage( sprintf(Context::getLang('msg_import_finished'), $this->imported_count) );
|
if($this->position+$this->limit_count > $this->imported_count) {
|
||||||
|
$this->add('is_finished', 'Y');
|
||||||
|
$this->setMessage( sprintf(Context::getLang('msg_import_finished'), $this->imported_count) );
|
||||||
|
} else {
|
||||||
|
$this->add('position', $this->imported_count);
|
||||||
|
$this->add('is_finished', 'N');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -121,14 +130,22 @@
|
||||||
$buff = '';
|
$buff = '';
|
||||||
while(!feof($fp)) {
|
while(!feof($fp)) {
|
||||||
$str = fgets($fp,1024);
|
$str = fgets($fp,1024);
|
||||||
$buff .= trim($str);
|
$buff .= $str;
|
||||||
$buff = preg_replace_callback("!<member user_id=\"([^\"]*)\">(.*?)<\/member>!is", array($this, '_importMember'), $buff);
|
|
||||||
|
$buff = preg_replace_callback("!<member user_id=\"([^\"]*)\">(.*?)<\/member>!is", array($this, '_importMember'), trim($buff));
|
||||||
|
|
||||||
|
if($this->position+$this->limit_count <= $this->imported_count) break;
|
||||||
}
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _importMember($matches) {
|
function _importMember($matches) {
|
||||||
|
if($this->position > $this->imported_count) {
|
||||||
|
$this->imported_count++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$user_id = $matches[1];
|
$user_id = $matches[1];
|
||||||
$xml_doc = $this->oXml->parse($matches[0]);
|
$xml_doc = $this->oXml->parse($matches[0]);
|
||||||
|
|
||||||
|
|
@ -162,7 +179,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->imported_count ++;
|
$this->imported_count ++;
|
||||||
if(!$this->imported_count%50) usleep(100);
|
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
// 버튼에 사용되는 언어
|
// 버튼에 사용되는 언어
|
||||||
$lang->cmd_sync_member = '동기화';
|
$lang->cmd_sync_member = '동기화';
|
||||||
|
$lang->cmd_continue = '계속진행';
|
||||||
|
|
||||||
// 항목
|
// 항목
|
||||||
$lang->source_type = '이전 대상';
|
$lang->source_type = '이전 대상';
|
||||||
|
|
@ -36,6 +37,7 @@
|
||||||
$lang->msg_sync_member = '동기화 버튼을 클릭하시면 회원정보와 게시물정보의 동기화를 시작합니다.';
|
$lang->msg_sync_member = '동기화 버튼을 클릭하시면 회원정보와 게시물정보의 동기화를 시작합니다.';
|
||||||
$lang->msg_no_xml_file = 'XML파일을 찾을 수 없습니다. 경로를 다시 확인해주세요';
|
$lang->msg_no_xml_file = 'XML파일을 찾을 수 없습니다. 경로를 다시 확인해주세요';
|
||||||
$lang->msg_invalid_xml_file = '잘못된 형식의 XML파일입니다';
|
$lang->msg_invalid_xml_file = '잘못된 형식의 XML파일입니다';
|
||||||
|
$lang->msg_importing = '데이터를 입력중입니다. 혹시 아래 숫자가 변하지 않는다면 계속진행 버튼을 클릭해주세요.';
|
||||||
$lang->msg_import_finished = '%d개의 데이터 입력이 완료되었습니다. 상황에 따라 입력되지 못한 데이터가 있을 수 있습니다.';
|
$lang->msg_import_finished = '%d개의 데이터 입력이 완료되었습니다. 상황에 따라 입력되지 못한 데이터가 있을 수 있습니다.';
|
||||||
|
|
||||||
// 주절 주절..
|
// 주절 주절..
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,7 @@
|
||||||
<response callback_func="completeImport">
|
<response callback_func="completeImport">
|
||||||
<tag name="error" />
|
<tag name="error" />
|
||||||
<tag name="message" />
|
<tag name="message" />
|
||||||
|
<tag name="is_finished" />
|
||||||
|
<tag name="position" />
|
||||||
</response>
|
</response>
|
||||||
</filter>
|
</filter>
|
||||||
|
|
|
||||||
|
|
@ -80,15 +80,21 @@
|
||||||
|
|
||||||
<!-- step 2. XML 파일 지정 -->
|
<!-- step 2. XML 파일 지정 -->
|
||||||
<div id="step2" style="display:none">
|
<div id="step2" style="display:none">
|
||||||
<form action="./" method="get" onsubmit="return doStep2(this)">
|
<form action="./" method="get" onsubmit="return doStep2(this)" id="fo_step2">
|
||||||
<input type="hidden" name="module_srl" value="" />
|
<input type="hidden" name="module_srl" value="" />
|
||||||
<input type="hidden" name="category_srl" value="" />
|
<input type="hidden" name="category_srl" value="" />
|
||||||
|
<input type="hidden" name="position" value="0" />
|
||||||
<div style="font-weight:bold">{$lang->import_step_title[2]}</div>
|
<div style="font-weight:bold">{$lang->import_step_title[2]}</div>
|
||||||
<div>{$lang->import_step_desc[2]}</div>
|
<div>{$lang->import_step_desc[2]}</div>
|
||||||
<div>
|
<div>
|
||||||
<input type="text" name="xml_file" value="./" />
|
<input type="text" name="xml_file" value="./" />
|
||||||
<input type="submit" value="{$lang->cmd_next}" />
|
<input type="submit" value="{$lang->cmd_next}" />
|
||||||
</div>
|
</div>
|
||||||
|
<div id="step2_status" style="display:none">
|
||||||
|
<div>{$lang->msg_importing}</div>
|
||||||
|
<div id="step2_position"></div>
|
||||||
|
<div><input type="button" onclick="procFilter(); return false" value="{$lang->cmd_continue}" /></div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,11 +76,29 @@ function doStep2(fo_obj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
procFilter(fo_obj, import_xml);
|
procFilter(fo_obj, import_xml);
|
||||||
|
|
||||||
|
xGetElementById('step2_status').style.display = 'block';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Step Complete Import */
|
/* Step Complete Import */
|
||||||
function completeImport(ret_obj) {
|
function completeImport(ret_obj) {
|
||||||
alert(ret_obj["message"]);
|
var message = ret_obj['message'];
|
||||||
location.href = location.href;
|
var is_finished = ret_obj['is_finished'];
|
||||||
|
var position = ret_obj['position'];
|
||||||
|
|
||||||
|
if(is_finished=='Y') {
|
||||||
|
alert(ret_obj["message"]);
|
||||||
|
location.href = location.href;
|
||||||
|
} else {
|
||||||
|
var fo_obj = xGetElementById('fo_step2');
|
||||||
|
fo_obj.position.value = position;
|
||||||
|
xInnerHtml('step2_position', position);
|
||||||
|
procFilter(fo_obj, import_xml);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function doManualProcess() {
|
||||||
|
var fo_obj = xGetElementById('fo_step2');
|
||||||
|
procFilter(fo_obj, import_xml);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue