mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-23 05:09:56 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@11755 201d5d3c-b55e-5fd7-737f-ddc643e51545
1 line
No EOL
4 KiB
JavaScript
1 line
No EOL
4 KiB
JavaScript
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('<div class="x_modal-backdrop" />');}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;m<q;m++){u=c[m];l[u]?l[u].value=p[u]:0;}n=get_by_id(h);if(n){s=["target_module","guestbook_target_module","user_id","unit_count"];for(m=0,q=s.length;m<q;m++){u=s[m];if(n.elements[u]){r.elements[u].value=n.elements[u].value;}}}jQuery("#preProgressMsg").hide();jQuery("#progressMsg").show();doImport(h);}return false;}function doImport(g){var d=get_by_id("fo_process"),a=d.elements,b,j,f={},e;for(b=0,j=a.length;b<j;b++){f[a[b].name]=a[b].value;}function h(k,p){var m,q,l,o;for(m=0,q=e.length;m<q;m++){l=e[m];a[l]?a[l].value=k[l]:0;}k.total=parseInt(k.total,10)||0;k.cur=parseInt(k.cur,10)||0;percent=parseInt((k.cur/k.total)*100);jQuery("#totalCount").text(k.total);jQuery("#completeCount").text(k.cur);jQuery("#progressBar").width(percent+"%");jQuery("#progressPercent").html(percent+"%");if(k.total>k.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('<div class="progressBox"><div class="progress1"></div><div class="progress2"></div></div>');}a.find("div.progress1").html(b+" ").css("width",b+"%").end().find("div.progress2").text(e+"/"+d);} |