ACMS.Dispatch.Edit._direct=function(elm){var action=$(elm).parent("form").attr("action"),admin=$(elm).nextAll('input[name="admin"]').val(),fragment=$(elm).nextAll('input[name="fragment"]').val(),bid=$(elm).nextAll('input[name="bid"]').val(),cid=$(elm).nextAll('input[name="cid"]').val(),eid=$(elm).nextAll('input[name="eid"]').val();if(admin==="entry-add-module"){window.alert(ACMS.Config.moduleUnitDirectAddMsg);return}var url=ACMS.Library.acmsLink({eid:eid,tpl:"ajax/unit-add-single.html",admin:admin.replace(/add/g,"update-unit"),query:{hash:Math.random().toString()}},true);var $editInplaceBox=$("#js-edit_inplace-box"),$html={};if(!$editInplaceBox.size()){$editInplaceBox=$($.parseHTML('<div id="js-edit_inplace-box" />')).appendTo("body")}$.ajax({type:"GET",url:url,dataType:"html",success:function(html){$html=$($.parseHTML(html));$('#more, .sorthandle, .togglebody, .formEntryActionUnit, .entryFormFileControl option[value="delete"], [for^="input-checkbox-file_edit_"], input[value="delete"]',$html).remove();$editInplaceBox.empty().append($html);$(".js-edit_inplace-loading").remove();$editInplaceBox.fadeIn("fast").position({of:window,my:"center center"}).draggable({handle:ACMS.Config.Edit.itemHeadMark,opacity:.8,scroll:true,distance:5});var $submit=$editInplaceBox.find("[name^=ACMS_POST_Unit_Update]");var submit_name=$submit.attr("name");$submit.attr("name",submit_name.replace(/ACMS_POST_Unit_Update/g,"ACMS_POST_Entry_Direct"));$editInplaceBox.find("input[type=file]").removeAttr("multiple").get(0);ACMS.Dispatch.Edit($editInplaceBox);$(".removethis",$editInplaceBox).unbind().attr("class","closethis").bind("click",function(){$("#js-edit_inplace-box").hide();$("#js-edit_inplace-title").hide()});$("#js-edit_inplace-submit",$editInplaceBox).unbind().bind("click",function(){var $form=$(this).closest("form").attr("target","js-edit_inplace-async"),$iframe=$('iframe[name="js-edit_inplace-async"]');if(!$iframe.size()){$iframe=$($.parseHTML('<iframe name="js-edit_inplace-async" style="display:none;"></iframe>')).appendTo("body")}$form.unbind().submit(function(){$iframe.unbind().load(function(){var html=$iframe.contents().find("body").html(),$html=$($.parseHTML(html));$("#js-edit_inplace-box").hide();$("#js-edit_inplace-title").hide();$html.insertAfter($(".js-edit_inplace:last"));ACMS.Dispatch.Utility($html);ACMS.Dispatch.Edit($html.parent());ACMS.Dispatch($html.get(0))})}).submit()})},error:function(xhr,statusText){window.alert("ユニットの追加に失敗しました。ダイレクト編集で追加できないタイプのユニットの可能性があります。お手数ですが編集画面より編集ください。")}})};