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();var self={action:action,admin:admin,fragment:fragment,bid:bid,cid:cid,eid:eid};if(admin=="entry-add-media"){var url=ACMS.Library.acmsLink({eid:eid,tpl:"ajax/unit-add-single.html",
admin:"entry-update-unit-media",Query:{hash:Math.random().toString()}},true);var $editinBox=$("#js-edit_inplace-box"),$html={};if(!$editinBox.size())$editinBox=$($.parseHTML('<div id="js-edit_inplace-box" />')).appendTo("body");$.ajax({type:"GET",url:url,dataType:"html",error:function(xhr,statusText){$editinBox.empty().append($(xhr.responseText)).css("background-color","white");$(".js-edit_inplace-loading").remove();$editinBox.fadeIn("fast").position({of:window,my:"center center"}).draggable({handle:ACMS.Config.Edit.itemHeadMark,
opacity:0.8,scroll:true,distance:5}).css("z-index",4096)},success:function(html){$html=$($.parseHTML(html));$('#more, .sorthandle, .togglebody, .formEntryActionUnit, .entryFormFileControl option[value="delete"], [for^="input-checkbox-file_edit_"], input[value="delete"]',$html).remove();$editinBox.empty().append($html);$(".js-edit_inplace-loading").remove();$editinBox.fadeIn("fast").position({of:window,my:"center center"}).draggable({handle:ACMS.Config.Edit.itemHeadMark,opacity:0.8,scroll:true,distance:5}).css("z-index",
4096);ACMS.Dispatch.Edit($editinBox);$(".removethis",$editinBox).unbind().attr("class","closethis").bind("click",function(){$("#js-edit_inplace-box").hide();$("#js-edit_inplace-title").hide()});$("#js-edit_inplace-submit",$editinBox).unbind().bind("click",function(){var $form=$(this).parent().attr("target","js-edit_inplace-async");$form.unbind().submit(function(event){event.preventDefault();$.ajax({url:$form.attr("action"),type:$form.attr("method"),data:$form.serialize(),success:function(res){var $tgt=
$($.parseHTML(res));$("#js-edit_inplace-box").hide();$("#js-edit_inplace-title").hide();$tgt.insertAfter($(".js-edit_inplace:last"));ACMS.Dispatch.Utility($tgt);ACMS.Dispatch.Edit($tgt.parent())}})}).submit()})}})}else $.ajax({type:"POST",admin:self.admin,url:self.action,data:{ACMS_POST_Entry_Direct:true,bid:self.bid,cid:self.cid,eid:self.eid,admin:self.admin,fragment:self.fragment},success:function(res){if(0===$(".ui-sortable .js-edit_inplace:last").size()){location.reload();return false}else{var $resdata=
$($.parseHTML(res));if($(":first-child",res).hasClass("js-edit_inplace"))$(".entryColumn.ui-sortable > :last").after($resdata);else $(".ui-sortable .js-edit_inplace:last").after($resdata);if(jQuery.support.opacity)$resdata.each(function(){if(0||$(this).hasClass("js-edit_inplace")||$(this).find(".js-edit_inplace").length)$(this).fadeTo(250,0.1).fadeTo(450,$(this).css("opacity"))});ACMS.Dispatch($resdata.parent()[0])}},failed:function(){console.log("ACMS.Dispatch.Edit._direct failed")}})};
