issue 70 data import admin developement.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9019 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2011-09-05 02:20:54 +00:00
parent 702267086f
commit df61d2913d
6 changed files with 92 additions and 244 deletions

View file

@ -344,6 +344,14 @@ Hãy nhập đường dẫn cho File chứa Data trên Host dưới dạng http:
<value xml:lang="tr"><![CDATA[Lütfen senkronizasyonu başlatmak için Senkronizasyon düğmesine basınız.]]></value>
<value xml:lang="vi"><![CDATA[Data thành viên và bài viết sẽ được đồng bộ hóa sau khi bấm "Đồng bộ".]]></value>
</item>
<item name="cmd_check_path">
<value xml:lang="ko"><![CDATA[경로 확인]]></value>
<value xml:lang="en"><![CDATA[Check the path]]></value>
</item>
<item name="msg_exist_xml_file">
<value xml:lang="ko"><![CDATA[XML파일을 찾았습니다.]]></value>
<value xml:lang="en"><![CDATA[Success find the XML file.]]></value>
</item>
<item name="msg_no_xml_file">
<value xml:lang="ko"><![CDATA[XML파일을 찾을 수 없습니다. 경로를 다시 확인해주세요.]]></value>
<value xml:lang="en"><![CDATA[Could not find the XML file. Please check the path again]]></value>
@ -524,4 +532,4 @@ Eğer aynı sunucuda değilse, lütfen Zeroboard4\'ün kurulu olduğu adresi gir
Nếu nó cùng nằm trên một Server, hãy nhập đầy đủ đường dẫn thư mục cài đặt của Zeroboard4. Ví dụ: <b>/home/USERID/public_html/bbs</b>
Nếu khác Server, hãy nhập địa chỉ của Zeroboard4 đã cài đặt. Ví dụ: <b>http://Domain/bbs</b>]]></value>
</item>
</lang>
</lang>

View file

@ -8,15 +8,16 @@
<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="unit_count" value="10" />
<h2 class="h2">{$lang->type_module}</h2>
<ul>
<li>
<p class="q">{$lang->xml_path} {$lang->path_info}</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>
<button type="button">{$lang->cmd_check_path}</button>
<em class="desc error">{$lang->msg_no_xml_file}</em>
<em class="desc success">{$lang->msg_exist_xml_file}</em>
</p>
</li>
<li class="xml ttxml modulefinder">
@ -66,17 +67,18 @@
<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">
<form action="./" class="form" method="get" onsubmit="return doPreProcessing(this, 'memberFrom')" id="memberForm">
<input type="hidden" name="type" value="member" />
<input type="hidden" name="unit_count" value="100" />
<h2 class="h2">{$lang->type_member}</h2>
<ul>
<li>
<p class="q">{$lang->xml_path} {$lang->path_info}</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>
<button type="button">{$lang->cmd_check_path}</button>
<em class="desc error">{$lang->msg_no_xml_file}</em>
<em class="desc success">{$lang->msg_exist_xml_file}</em>
</p>
</li>
</ul>
@ -86,15 +88,16 @@
</form>
<form action="./" class="form" method="get" onsubmit="return doPreProcessing(this)" id="fo_import">
<input type="hidden" name="type" value="message" />
<input type="hidden" name="unit_count" value="100" />
<h2 class="h2">{$lang->type_message}</h2>
<ul>
<li>
<p class="q">{$lang->xml_path} {$lang->path_info}</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>
<button type="button">{$lang->cmd_check_path}</button>
<em class="desc error">{$lang->msg_no_xml_file}</em>
<em class="desc success">{$lang->msg_exist_xml_file}</em>
</p>
</li>
</ul>
@ -116,21 +119,21 @@
<input type="hidden" name="user_id" value="" />
<p style="text-align:center">
<span class="prgrs prgrsMedium">
<strong>{$lang->import_step_desc[99]}</strong>
<strong id="preProgressMsg">{$lang->preprocessing}</strong>
<strong id="progressMsg" style="display:none;">{$lang->import_step_desc[99]}</strong>
<span class="pBar" style="width:300px;text-align:left">
<span class="pAction" style="width:50%"><!-- Progress status --></span>
<span class="pNum">123/1234</span>
<span class="pAction" id="progressBar" style="width:0%"><!-- Progress status --></span>
<span class="pNum"><span id="completeCount">0</span>/<span id="totalCount">0</span></span>
</span>
<strong>50%</strong>
<strong id="progressPercent">0%</strong>
</span>
</p>
</form>
</div>
<script type="text/javascript">
jQuery(function($){
$('.form input[type=submit]').click(function(){
$('.modalAnchor').click();
});
});
jQuery('a.modalAnchor')
.bind('before-close.mw', function(event){
return false;
});
</script>
<!--// process 진행상황 끝 -->

View file

@ -52,7 +52,6 @@ $('.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(){
@ -105,9 +104,10 @@ function doPreProcessing(form, formId) {
if(!xml_file) return false;
//$form = $('#importForm').hide();
//$process = $('#process').show();
//$status = $('#status').empty();
// show modal window
$process = $('#process');
if(!$process.find('.bg').length) $process.prepend('<span class="bg" />').appendTo('body');
$('a[href="#process"].modalAnchor').trigger('open.mw');
exec_xml(
'importer', // module
@ -144,6 +144,8 @@ function doPreProcessing(form, formId) {
}
}
jQuery('#preProgressMsg').hide();
jQuery('#progressMsg').show();
doImport(formId);
}
@ -153,16 +155,12 @@ function doPreProcessing(form, formId) {
/* @brief Start importing */
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);
function on_complete(ret, response_tags) {
console.log(ret);
var i, c, key;
for(i=0,c=resp.length; i < c; i++) {
@ -173,17 +171,22 @@ function doImport(formId) {
ret.total = parseInt(ret.total, 10) || 0;
ret.cur = parseInt(ret.cur, 10) || 0;
percent = parseInt((ret.cur/ret.total)*100);
jQuery('#totalCount').text(ret.total);
jQuery('#completeCount').text(ret.cur);
jQuery('#progressBar').width(percent+'%');
jQuery('#progressPercent').html(percent + "%");
if(ret.total > ret.cur) {
doImport(formId);
} else {
alert('성공입니까?');
alert(ret.message);
jQuery('a[href="#process"].modalAnchor').unbind('before-close.mw').trigger('close.mw');
try {
form.reset();
get_by_id(formId).reset();
//jQuery('#process').hide();
//jQuery('#importForm').show();
} catch(e){};
}
}
@ -220,3 +223,4 @@ function displayProgress(total, cur) {
.find('div.progress2')
.text(cur+'/'+total);
}

View file

@ -249,12 +249,39 @@
{
$menuSrl = Context::get('menu_srl');
$args->title = Context::get('title');
$childKeyList = Context::get('child_key');
$parentKeyList = Context::get('parent_key');
$itemKeyList = Context::get('item_key');
debugPrint($parentKeyList);
debugPrint($itemKeyList);
// menu name update
$args->menu_srl = $menuSrl;
/*$args->menu_srl = $menuSrl;
$output = executeQuery('menu.updateMenu', $args);
if(!$output->toBool()) return $output;
if(!$output->toBool()) return $output;*/
if(is_array($parentKeyList))
{
$menuList = array();
foreach($parentKeyList AS $key=>$value)
{
if($value == 0) $menuList[$itemKeyList[$key]] = array();
}
}
debugPrint($menuList);
exit;
if(is_array($itemKeyList))
{
foreach($itemKeyList AS $key=>$value)
{
if($parentKeyList[$key] != 0)
{
$menuList[$parentKeyList[$key]][$value] = true;
}
}
}
debugPrint($menuList);
exit;
// menu item sorting
if(is_array($childKeyList))

View file

@ -1,228 +1,32 @@
/* NHN (developers@xpressengine.com) */
jQuery(function($){
var
dragging = false,
$holder = $('<li class="placeholder">');
$('form.siteMap')
.delegate('li:not(.placeholder)', {
'mousedown.st' : function(event) {
var $this, $uls, $ul, width, height, offset, position, offsets, i, dropzone, wrapper='';
.delegate('li:not(.placeholder)', 'dropped.st', function() {
var $this = $(this), $pkey, $mkey, is_child;
if($(event.target).is('a,input,label,textarea') || event.which != 1) return;
$pkey = $this.find('>input._parent_key');
is_child = !!$this.parent('ul').parent('li').length;
dragging = true;
$this = $(this);
height = $this.height();
width = $this.width();
$uls = $this.parentsUntil('.siteMap').filter('ul');
$ul = $uls.eq(-1);
$ul.css('position', 'relative');
position = {x:event.pageX, y:event.pageY};
offset = getOffset(this, $ul.get(0));
$clone = $this.clone(true).attr('target', true);
for(i=$uls.length-1; i; i--) {
$clone = $clone.wrap('<li><ul /></li>').parent().parent();
}
// get offsets of all list-item elements
offsets = [];
$ul.find('li').each(function(idx) {
if($this[0] === this || $this.has(this).length) return true;
var o = getOffset(this, $ul.get(0));
offsets.push({top:o.top, bottom:o.top+32, item:this});
});
// Remove unnecessary elements from the clone, set class name and styles.
// Append it to the list
$clone
.find('.side,input').remove().end()
.addClass('draggable')
.css({
position: 'absolute',
opacity : .6,
width : width,
height : height,
left : offset.left,
top : offset.top,
zIndex : 100
})
.appendTo($ul.eq(0));
// Set a place holder
$holder
.css({
position:'absolute',
opacity : .6,
width : width,
height : '5px',
left : offset.left,
top : offset.top,
zIndex :99
})
.appendTo($ul.eq(0));
$this.css('opacity', .6);
$(document)
.unbind('mousemove.st mouseup.st')
.bind('mousemove.st', function(event) {
var diff, nTop, item, i, c, o;
dropzone = null;
diff = {x:position.x-event.pageX, y:position.y-event.pageY};
nTop = offset.top - diff.y;
for(i=0,c=offsets.length; i < c; i++) {
o = offsets[i];
if(o.top <= nTop && o.bottom >= nTop) {
dropzone = {element:o.item, state:setHolder(o,nTop)};
break;
}
}
$clone.css({top:nTop});
})
.bind('mouseup.st', function(event) {
var $dropzone, $li;
dragging = false;
$(document).unbind('mousemove.st mouseup.st');
$this.css('opacity', '');
$clone.remove();
$holder.remove();
// dummy list item for animation
$li = $('<li />').height($this.height());
if(!dropzone) return;
$dropzone = $(dropzone.element);
$this.before($li);
if(dropzone.state == 'prepend') {
if(!$dropzone.find('>ul').length) $dropzone.find('>.side').after('<ul>');
$dropzone.find('>ul').prepend($this.hide());
} else {
$dropzone[dropzone.state]($this.hide());
}
$this.slideDown(100, function(){ $this.removeClass('active') });
$li.slideUp(100, function(){ var $par = $li.parent(); $li.remove(); if(!$par.children('li').length) $par.remove() });
});
return false;
},
'mouseover.st' : function() {
if(!dragging) $(this).addClass('active');
return false;
},
'mouseout.st' : function() {
if(!dragging) $(this).removeClass('active');
return false;
if(is_child) {
$pkey.val($this.parent('ul').parent('li').find('>input._item_key').val());
} else {
$pkey.val('0');
}
})
.find('li')
.prepend('<button type="button" class="moveTo">Move to</button>')
.append('<span class="vr"></span><span class="hr"></span>')
.find('input:text')
.focus(function(){
var $this = $(this), $label = $this.prev('label'), $par = $this.parent();
$this.width($par.width() - (parseInt($par.css('text-indent'))||0) - $this.next('.side').width() - 60).css('opacity', '');
$label.hide();
})
.blur(function(){
var $this = $(this), $label = $this.prev('label'), val = $this.val();
$this.width(0).css('opacity', 0);
$label.removeClass('no-text').empty().text(val).show();
if(!val) $label.addClass('no-text').text('---');
})
.each(function(i,input){
var $this = $(this), id='sitemap-id-'+i;
$this
.attr('id', id)
.css({width:0,opacity:0,overflow:'hidden'})
.before('<label />')
.prev('label')
.attr('for', id)
.text($this.val());
})
.end()
.end()
$('<div id="dropzone-marker" />')
.css({display:'none',position:'absolute',backgroundColor:'#000',opacity:0.7})
.appendTo('body');
function getOffset(elem, offsetParent) {
var top = 0, left = 0;
while(elem && elem != offsetParent) {
top += elem.offsetTop;
left += elem.offsetLeft;
elem = elem.offsetParent;
}
return {top:top, left:left};
}
function setHolder(info, yPos) {
if(Math.abs(info.top-yPos) <= 3) {
$holder.css({top:info.top-3,height:'5px'});
return 'before';
} else if(Math.abs(info.bottom-yPos) <= 3) {
$holder.css({top:info.bottom-3,height:'5px'});
return 'after';
} else {
$holder.css({top:info.top+3,height:'27px'});
return 'prepend';
}
}
/*
$('.tgMap').click(function(){
var t = $(this);
t.parent('.siteMap').toggleClass('fold');
if(t.parent('.siteMap').hasClass('fold')){
t.text('펼치기').next('.lined').slideUp(200).next('.btnArea').hide();
} else {
t.text('접기').next('.lined').slideDown(200).next('.btnArea').show();
}
return false;
});
*/
var editForm = $('#editForm');
var menuSrl = null;
var menuForm = null;
var menuUrl = null;
$('a._edit').click(function(){
var parentKey = $(this).parent().prevAll('._parent_key').val();
var childKey = $(this).parent().prevAll('._child_key').val();
var itemKey = $(this).parent().prevAll('._item_key').val();
menuSrl = $(this).parents().prevAll('input[name=menu_srl]').val();
menuForm = $('#menu_'+menuSrl);
var menuItemSrl = null;
if(parentKey) menuItemSrl = parentKey;
else if(childKey) menuItemSrl = childKey;
else
{
alert('empty menu item key');
return;
}
menuItemSrl = itemKey;
var params = new Array();
var response_tags = new Array('menu_item');
@ -283,7 +87,7 @@ $('.tgMap').click(function(){
menuSrl = $(this).parents().prevAll('input[name=menu_srl]').val();
menuForm = $('#menu_'+menuSrl);
var menu_item_srl = $(this).parent().prevAll('._child_key').val();
var menu_item_srl = $(this).parent().prevAll('._item_key').val();
menuForm.find('input[name=menu_item_srl]').val(menu_item_srl);
menuForm.submit();
});

View file

@ -1,3 +1,4 @@
<load target="../../admin/tpl/js/sitemap.js" />
<load target="./js/sitemap.js" />
<div class="content" id="content">
@ -17,13 +18,14 @@
<a href="#nav1" class="tgMap">접기</a>
<ul class="lined" id="nav1">
<li loop="$value->menuItems=>$key2,$value2">
<input type="hidden" name="parent_key[]" value="{$key2}" class="_parent_key" />
<input type="hidden" name="child_key[]" value="BEGIN_{$key2}" class="_child_key" />
<input type="hidden" name="parent_key[]" value="0" class="_parent_key" />
<input type="hidden" name="item_key[]" value="{$key2}" class="_item_key" />
<a href="#" class="ms">{$value2['name']}</a> <a href="#" class="wPreview" target="_blank">Preview</a>
<span class="side"><a href="#editMenu" class="modalAnchor _edit">Edit...</a> | <a href="#delete" class="_delete">Delete</a></span>
<ul cond="$value2['subMenu']>0">
<li loop="$value2['subMenu']=>$key3,$value3">
<input type="hidden" name="child_key[]" value="{$key3}" class="_child_key" />
<input type="hidden" name="parent_key[]" value="{$key2}" class="_parent_key" />
<input type="hidden" name="item_key[]" value="{$key3}" class="_item_key" />
{$value3->name} <a href="#" class="wPreview" target="_blank">Preview</a> <span class="side"><a href="#editMenu" class="modalAnchor _edit">Edit...</a> | <a href="#delete" class="_delete">Delete</a></span>
</li>
</ul>