diff --git a/modules/importer/tpl/js/importer_admin.js b/modules/importer/tpl/js/importer_admin.js index 34fd8c2cd..bc5e0f201 100644 --- a/modules/importer/tpl/js/importer_admin.js +++ b/modules/importer/tpl/js/importer_admin.js @@ -72,7 +72,7 @@ $('.checkxml') }) .end() .find('.x_help-inline').hide().end() - .closest('form').find('>.ttxml')/*.hide()*/.end().end() + .closest('form').find('>.ttxml').hide().end().end() .closest('form').find(':submit').attr('disabled','disabled'); // hide 'sync member' block diff --git a/modules/importer/tpl/js/importer_admin.min.js b/modules/importer/tpl/js/importer_admin.min.js index 68932d3b5..14d97a873 100644 --- a/modules/importer/tpl/js/importer_admin.min.js +++ b/modules/importer/tpl/js/importer_admin.min.js @@ -1 +1,14 @@ -jQuery(function(a){a(".checkxml").find("input:text").change(function(){a(this).closest(".checkxml").find(".x_help-inline").hide();}).end().find("button").click(function(){var g,j,h,b,i,k,f,d;g=a(this).prop("disabled",true);k=g.closest("form");j=g.closest(".checkxml");h=j.find("input").prop("disabled",true).addClass("loading");$message=j.find(".x_help-inline").hide();function c(o){var l,n,m;m=k.find(">.xml");n=k.find(">.ttxml");$message.text(o.result_message);if(o.error||o.exists!="true"){$message.attr("class","x_help-inline").fadeIn(300);n=n.filter(":visible");n.eq(-1).slideUp(100,function(){n=n.slice(0,-1).eq(-1).slideUp(100,arguments.callee);});k.find(":submit").attr("disabled","disabled");return e();}$message.attr("class","x_help-inline").fadeIn(300);k.find(":submit").removeAttr("disabled");f=k.find(".syncmember:hidden");h.prop("disabled",false).removeClass("loading");g.prop("disabled",false);if(o.type=="XML"){m.not(":visible").add(f).slideDown(300);}else{if(o.type=="TTXML"){n.not(":visible").add(f).slideDown(300);k.find("input[name=type]").val("ttxml");}}}function e(){h.prop("disabled",false).removeClass("loading");g.prop("disabled",false);k.find(".syncmember:visible").slideUp(100);return false;}show_waiting_message=false;a.exec_json("importer.procImporterAdminCheckXmlFile",{filename:a.trim(h.val())},c);}).end().find(".x_help-inline").hide().end().closest("form").find(">.ttxml").end().end().closest("form").find(":submit").attr("disabled","disabled");a(".syncmember").hide();});function doSync(a){exec_xml("importer","procImporterAdminSync",[],function(b){alert(b.message);location.href=location.href;});return false;}function doPreProcessing(a,h){var e,f,c,k=false,d=jQuery,i,g,j;e=a.elements.xml_file.value;f=a.elements.type.value;if(!e){return false;}g=d("#process");if(!d("body").children(".x_modal-backdrop").length){d("body").append('
');}d('a[href="#process"].modalAnchor').trigger("open.mw");exec_xml("importer","procImporterAdminPreProcessing",{type:f,xml_file:e},b,c=["error","message","type","total","cur","key","status"]);function b(p){var o,t,r,l,m,q,u,s,n;k=true;if(p.status==-1){return alert(p.message);}r=get_by_id("fo_process");l=r.elements;for(m=0,q=c.length;mk.cur){doImport(g);}else{function n(){alert(k.message);jQuery('a[href="#process"].modalAnchor').unbind("before-close.mw").trigger("close.mw").find("#progressBar").width(1).end().find("#progressPercent").html("0%").end();try{d.reset();get_by_id(g).reset();}catch(c){}jQuery("span.btn > input[type=submit]").attr("disabled","disabled");}o=get_by_id(g);if(o!=null&&o.isSync.checked){exec_xml("importer","procImporterAdminSync",f,function(c){if(c&&(!c.error||c.error=="0")){n();}},e=["error","message"]);}else{n();}}}show_waiting_message=false;exec_xml("importer","procImporterAdminImport",f,h,e=["error","message","type","total","cur","key"]);show_waiting_message=true;return false;}function displayProgress(d,e){var b,c,a;b=Math.max(d?Math.round(e/d*100):100,1);a=jQuery("#status");if(!a.find("div.progress1").length){a.html('
');}a.find("div.progress1").html(b+" ").css("width",b+"%").end().find("div.progress2").text(e+"/"+d);} \ No newline at end of file +/** + * @file modules/importer/js/importer_admin.js + * @author NHN (developers@xpressengine.com) + * @brief importer에서 사용하는 javascript + **/ +jQuery(function($){$('.checkxml').find('input:text').change(function(){$(this).closest('.checkxml').find('.x_help-inline').hide()}).end().find('button').click(function(){var $this,$container,$input,$messages,$loading,$form,$syncmember,count;$this=$(this).prop('disabled',true);$form=$this.closest('form');$container=$this.closest('.checkxml');$input=$container.find('input').prop('disabled',true).addClass('loading');$message=$container.find('.x_help-inline').hide() +function on_complete(data){var $ul,$ttxml,$xml;$xml=$form.find('>.xml');$ttxml=$form.find('>.ttxml');$message.text(data.result_message);if(data.error||data.exists!='true'){$message.attr('class','x_help-inline').fadeIn(300);$ttxml=$ttxml.filter(':visible');$ttxml.eq(-1).slideUp(100,function(){$ttxml=$ttxml.slice(0,-1).eq(-1).slideUp(100,arguments.callee)});$form.find(':submit').attr('disabled','disabled');return restore()};$message.attr('class','x_help-inline').fadeIn(300);$form.find(':submit').removeAttr('disabled');$syncmember=$form.find('.syncmember:hidden');$input.prop('disabled',false).removeClass('loading');$this.prop('disabled',false);if(data.type=='XML'){$xml.not(':visible').add($syncmember).slideDown(300)}else if(data.type=='TTXML'){$ttxml.not(':visible').add($syncmember).slideDown(300);$form.find('input[name=type]').val('ttxml')}} +function restore(){$input.prop('disabled',false).removeClass('loading');$this.prop('disabled',false);$form.find('.syncmember:visible').slideUp(100);return false};show_waiting_message=false;$.exec_json('importer.procImporterAdminCheckXmlFile',{filename:$.trim($input.val())},on_complete)}).end().find('.x_help-inline').hide().end().closest('form').find('>.ttxml').hide().end().end().closest('form').find(':submit').attr('disabled','disabled');$('.syncmember').hide()}) +function doSync(fo_obj){exec_xml('importer','procImporterAdminSync',[],function(ret){alert(ret.message);location.href=location.href});return false} +function doPreProcessing(form,formId){var xml_file,type,resp,prepared=false,$=jQuery,$status,$process,$form;xml_file=form.elements['xml_file'].value;type=form.elements['type'].value;if(!xml_file)return false;$process=$('#process');if(!$('body').children('.x_modal-backdrop').length)$('body').append('
');$('a[href="#process"].modalAnchor').trigger('open.mw');exec_xml('importer','procImporterAdminPreProcessing',{type:type,xml_file:xml_file},on_complete,resp=['error','message','type','total','cur','key','status']) +function on_complete(ret){var $reload,$cont,fo_proc,elems,i,c,key,to_copy,fo_import;prepared=true;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;iret.cur){doImport(formId)}else{function resultAlertMessage(){alert(ret.message);jQuery('a[href="#process"].modalAnchor').unbind('before-close.mw').trigger('close.mw').find('#progressBar').width(1).end().find('#progressPercent').html('0%').end();try{form.reset();get_by_id(formId).reset()}catch(e){};jQuery('span.btn > input[type=submit]').attr('disabled','disabled')};fo_import=get_by_id(formId);if(fo_import!=null&&fo_import.isSync.checked){exec_xml('importer','procImporterAdminSync',params,function(ret){if(ret&&(!ret.error||ret.error=='0'))resultAlertMessage()},resp=['error','message'])}else resultAlertMessage()}};show_waiting_message=false;exec_xml('importer','procImporterAdminImport',params,on_complete,resp=['error','message','type','total','cur','key']);show_waiting_message=true;return false} +function displayProgress(total,cur){var per,stat,$stat;per=Math.max(total?Math.round(cur/total*100):100,1);$stat=jQuery('#status');if(!$stat.find('div.progress1').length)$stat.html('
');$stat.find('div.progress1').html(per+' ').css('width',per+'%').end().find('div.progress2').text(cur+'/'+total)} \ No newline at end of file