diff --git a/classes/page/PageHandler.class.php b/classes/page/PageHandler.class.php index 487ffc215..56656585d 100644 --- a/classes/page/PageHandler.class.php +++ b/classes/page/PageHandler.class.php @@ -29,7 +29,7 @@ $this->page_count = $page_count; $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; $last_page = $total_page; if($last_page>$total_page) $last_page = $total_page; @@ -43,7 +43,7 @@ **/ function getNextPage() { $page = $this->first_page+$this->point++; - if($page > $this->last_page) $page = 0; + if($this->point > $this->page_count) $page = 0; return $page; } } diff --git a/modules/importer/importer.controller.php b/modules/importer/importer.controller.php index ab82b21f9..98eaa0080 100644 --- a/modules/importer/importer.controller.php +++ b/modules/importer/importer.controller.php @@ -11,7 +11,9 @@ var $oMemberController = null; var $oDocumentController = null; + var $position = 0; var $imported_count = 0; + var $limit_count = 500; /** * @brief 초기화 @@ -94,6 +96,7 @@ $module_srl = Context::get('module_srl'); $category_srl = Context::get('category_list'); $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'); @@ -104,7 +107,13 @@ if($module_srl) $this->importModule($xml_file, $module_srl, $category_srl); 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 = ''; while(!feof($fp)) { $str = fgets($fp,1024); - $buff .= trim($str); - $buff = preg_replace_callback("!(.*?)<\/member>!is", array($this, '_importMember'), $buff); + $buff .= $str; + + $buff = preg_replace_callback("!(.*?)<\/member>!is", array($this, '_importMember'), trim($buff)); + + if($this->position+$this->limit_count <= $this->imported_count) break; } fclose($fp); } } function _importMember($matches) { + if($this->position > $this->imported_count) { + $this->imported_count++; + return; + } + $user_id = $matches[1]; $xml_doc = $this->oXml->parse($matches[0]); @@ -162,7 +179,6 @@ } $this->imported_count ++; - if(!$this->imported_count%50) usleep(100); } return ''; } diff --git a/modules/importer/lang/ko.lang.php b/modules/importer/lang/ko.lang.php index 91e13d0e2..d8662db83 100644 --- a/modules/importer/lang/ko.lang.php +++ b/modules/importer/lang/ko.lang.php @@ -7,6 +7,7 @@ // 버튼에 사용되는 언어 $lang->cmd_sync_member = '동기화'; + $lang->cmd_continue = '계속진행'; // 항목 $lang->source_type = '이전 대상'; @@ -36,6 +37,7 @@ $lang->msg_sync_member = '동기화 버튼을 클릭하시면 회원정보와 게시물정보의 동기화를 시작합니다.'; $lang->msg_no_xml_file = 'XML파일을 찾을 수 없습니다. 경로를 다시 확인해주세요'; $lang->msg_invalid_xml_file = '잘못된 형식의 XML파일입니다'; + $lang->msg_importing = '데이터를 입력중입니다. 혹시 아래 숫자가 변하지 않는다면 계속진행 버튼을 클릭해주세요.'; $lang->msg_import_finished = '%d개의 데이터 입력이 완료되었습니다. 상황에 따라 입력되지 못한 데이터가 있을 수 있습니다.'; // 주절 주절.. diff --git a/modules/importer/tpl/filter/import_xml.xml b/modules/importer/tpl/filter/import_xml.xml index bd2ba9f3a..695a82554 100644 --- a/modules/importer/tpl/filter/import_xml.xml +++ b/modules/importer/tpl/filter/import_xml.xml @@ -6,5 +6,7 @@ + + diff --git a/modules/importer/tpl/index.html b/modules/importer/tpl/index.html index 6b46b49c0..fc8cf28d1 100644 --- a/modules/importer/tpl/index.html +++ b/modules/importer/tpl/index.html @@ -80,15 +80,21 @@ diff --git a/modules/importer/tpl/js/importer_admin.js b/modules/importer/tpl/js/importer_admin.js index c7b17e473..49a60e4a5 100644 --- a/modules/importer/tpl/js/importer_admin.js +++ b/modules/importer/tpl/js/importer_admin.js @@ -76,11 +76,29 @@ function doStep2(fo_obj) { } procFilter(fo_obj, import_xml); + + xGetElementById('step2_status').style.display = 'block'; return false; } /* Step Complete Import */ function completeImport(ret_obj) { - alert(ret_obj["message"]); - location.href = location.href; + var message = ret_obj['message']; + 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); }