<\/div>").hide().prependTo(n(this.divTree).parent())),u==="after"||u==="before"||u==="over"){s=e.offset();switch(u){case"before":this.$dndMarker.removeClass("dynatree-drop-after dynatree-drop-over");this.$dndMarker.addClass("dynatree-drop-before");s.top-=8;break;case"after":this.$dndMarker.removeClass("dynatree-drop-before dynatree-drop-over");this.$dndMarker.addClass("dynatree-drop-after");s.top+=8;break;default:this.$dndMarker.removeClass("dynatree-drop-after dynatree-drop-before");this.$dndMarker.addClass("dynatree-drop-over");e.addClass("dynatree-drop-target");s.left+=8}this.$dndMarker.css({left:s.left,top:s.top,"z-index":1e3}).show()}else e.removeClass("dynatree-drop-target"),this.$dndMarker.hide();u==="after"?e.addClass("dynatree-drop-after"):e.removeClass("dynatree-drop-after");u==="before"?e.addClass("dynatree-drop-before"):e.removeClass("dynatree-drop-before");f===!0?(o&&o.addClass("dynatree-drop-accept"),e.addClass("dynatree-drop-accept"),r.addClass("dynatree-drop-accept")):(o&&o.removeClass("dynatree-drop-accept"),e.removeClass("dynatree-drop-accept"),r.removeClass("dynatree-drop-accept"));f===!1?(o&&o.addClass("dynatree-drop-reject"),e.addClass("dynatree-drop-reject"),r.addClass("dynatree-drop-reject")):(o&&o.removeClass("dynatree-drop-reject"),e.removeClass("dynatree-drop-reject"),r.removeClass("dynatree-drop-reject"))},_onDragEvent:function(t,i,r,u,f,e){var b=this.options,h=this.options.dnd,o=null,l=n(i.span),s,c,a,w;switch(t){case"helper":a=n("
<\/div>").append(n(u.target).closest("a").clone());n("ul.dynatree-container",i.tree.divTree).append(a);a.data("dtSourceNode",i);o=a;break;case"start":i.isStatusNode()?o=!1:h.onDragStart&&(o=h.onDragStart(i));o===!1?(this.logDebug("tree.onDragStart() cancelled"),f.helper.trigger("mouseup"),f.helper.hide()):l.addClass("dynatree-drag-source");break;case"enter":o=h.onDragEnter?h.onDragEnter(i,r):null;o={over:o!==!1&&(o===!0||o==="over"||n.inArray("over",o)>=0),before:o!==!1&&(o===!0||o==="before"||n.inArray("before",o)>=0),after:o!==!1&&(o===!0||o==="after"||n.inArray("after",o)>=0)};f.helper.data("enterResponse",o);break;case"over":if(c=f.helper.data("enterResponse"),s=null,c===!1)break;else if(typeof c=="string")s=c;else{var y=l.offset(),p={x:u.pageX-y.left,y:u.pageY-y.top},v={x:p.x/l.width(),y:p.y/l.height()};c.after&&v.y>.75?s="after":!c.over&&c.after&&v.y>.5?s="after":c.before&&v.y<=.25?s="before":!c.over&&c.before&&v.y<=.5?s="before":c.over&&(s="over");h.preventVoidMoves&&(i===r?s=null:s==="before"&&r&&i===r.getNextSibling()?s=null:s==="after"&&r&&i===r.getPrevSibling()?s=null:s==="over"&&r&&r.parent===i&&r.isLastSibling()&&(s=null));f.helper.data("hitMode",s)}s==="over"&&h.autoExpandMS&&i.hasChildren()!==!1&&!i.bExpanded&&i.scheduleAction("expand",h.autoExpandMS);s&&h.onDragOver&&(o=h.onDragOver(i,r,s));this._setDndStatus(r,i,f.helper,s,o!==!1);break;case"drop":if(w=f.helper.hasClass("dynatree-drop-reject"),s=f.helper.data("hitMode"),s&&h.onDrop&&!w)h.onDrop(i,r,s,f,e);break;case"leave":if(i.scheduleAction("cancel"),f.helper.data("enterResponse",null),f.helper.data("hitMode",null),this._setDndStatus(r,i,f.helper,"out",undefined),h.onDragLeave)h.onDragLeave(i,r);break;case"stop":if(l.removeClass("dynatree-drag-source"),h.onDragStop)h.onDragStop(i);break;default:throw"Unsupported drag event: "+t;}return o},cancelDrag:function(){var t=n.ui.ddmanager.current;t&&t.cancel()},lastentry:undefined};n.widget("ui.dynatree",{_init:function(){if(parseFloat(n.ui.version)<1.8)return this.options.debugLevel>=0&&_log("warn","ui.dynatree._init() was called; you should upgrade to jquery.ui.core.js v1.8 or higher."),this._create();this.options.debugLevel>=2&&_log("debug","ui.dynatree._init() was called; no current default functionality.")},_create:function(){var t=this.options,i;t.debugLevel>=1&&logMsg("Dynatree._create(): version='%s', debugLevel=%o.",n.ui.dynatree.version,this.options.debugLevel);this.options.event+=".dynatree";i=this.element.get(0);this.tree=new r(this);this.tree._load();this.tree.logDebug("Dynatree._init(): done.")},bind:function(){function r(t){t=n.event.fix(t||window.event);var i=n.ui.dynatree.getNode(t.target);return i?i._onFocus(t):!1}var i,t;this.unbind();i="click.dynatree dblclick.dynatree";this.options.keyboard&&(i+=" keypress.dynatree keydown.dynatree");this.element.bind(i,function(t){var i=n.ui.dynatree.getNode(t.target),r,u,f,o;if(!i)return!0;r=i.tree;u=r.options;r.logDebug("event(%s): dtnode: %s",t.type,i);f=r.phase;r.phase="userEvent";try{switch(t.type){case"click":return u.onClick&&u.onClick.call(r,i,t)===!1?!1:i._onClick(t);case"dblclick":return u.onDblClick&&u.onDblClick.call(r,i,t)===!1?!1:i._onDblClick(t);case"keydown":return u.onKeydown&&u.onKeydown.call(r,i,t)===!1?!1:i._onKeydown(t);case"keypress":return u.onKeypress&&u.onKeypress.call(r,i,t)===!1?!1:i._onKeypress(t)}}catch(e){o=null;r.logWarning("bind(%o): dtnode: %o, error: %o",t,i,e)}finally{r.phase=f}});t=this.tree.divTree;t.addEventListener?(t.addEventListener("focus",r,!0),t.addEventListener("blur",r,!0)):t.onfocusin=t.onfocusout=r},unbind:function(){this.element.unbind(".dynatree")},enable:function(){this.bind();n.Widget.prototype.enable.apply(this,arguments)},disable:function(){this.unbind();n.Widget.prototype.disable.apply(this,arguments)},getTree:function(){return this.tree},getRoot:function(){return this.tree.getRoot()},getActiveNode:function(){return this.tree.getActiveNode()},getSelectedNodes:function(){return this.tree.getSelectedNodes()},lastentry:undefined});parseFloat(n.ui.version)<1.8&&(n.ui.dynatree.getter="getTree getRoot getActiveNode getSelectedNodes");n.ui.dynatree.version="$Version: 1.2.1$";n.ui.dynatree.getNode=function(n){if(n instanceof i)return n;for(n.selector!==undefined&&(n=n[0]);n;){if(n.dtnode)return n.dtnode;n=n.parentNode}return null};n.ui.dynatree.getPersistData=t._getTreePersistData;n.ui.dynatree.prototype.options={title:"Dynatree",minExpandLevel:1,imagePath:null,children:null,initId:null,initAjax:null,autoFocus:!0,keyboard:!0,persist:!1,autoCollapse:!1,clickFolderMode:3,activeVisible:!0,checkbox:!1,selectMode:2,fx:null,noLink:!1,onClick:null,onDblClick:null,onKeydown:null,onKeypress:null,onFocus:null,onBlur:null,onQueryActivate:null,onQuerySelect:null,onQueryExpand:null,onPostInit:null,onActivate:null,onDeactivate:null,onSelect:null,onExpand:null,onLazyRead:null,onCustomRender:null,onCreate:null,onRender:null,postProcess:null,dnd:{onDragStart:null,onDragStop:null,autoExpandMS:1e3,preventVoidMoves:!0,onDragEnter:null,onDragOver:null,onDrop:null,onDragLeave:null},ajaxDefaults:{cache:!1,timeout:0,dataType:"json"},strings:{loading:"Loading…",loadError:"Load error!"},generateIds:!1,idPrefix:"dynatree-id-",keyPathSeparator:"/",cookieId:"dynatree",cookie:{expires:null},classNames:{container:"dynatree-container",node:"dynatree-node",folder:"dynatree-folder",empty:"dynatree-empty",vline:"dynatree-vline",expander:"dynatree-expander",connector:"dynatree-connector",checkbox:"dynatree-checkbox",nodeIcon:"dynatree-icon",title:"dynatree-title",noConnector:"dynatree-no-connector",nodeError:"dynatree-statusnode-error",nodeWait:"dynatree-statusnode-wait",hidden:"dynatree-hidden",combinedExpanderPrefix:"dynatree-exp-",combinedIconPrefix:"dynatree-ico-",nodeLoading:"dynatree-loading",hasChildren:"dynatree-has-children",active:"dynatree-active",selected:"dynatree-selected",expanded:"dynatree-expanded",lazy:"dynatree-lazy",focused:"dynatree-focused",partsel:"dynatree-partsel",lastsib:"dynatree-lastsib"},debugLevel:1,lastentry:undefined};parseFloat(n.ui.version)<1.8&&(n.ui.dynatree.defaults=n.ui.dynatree.prototype.options);n.ui.dynatree.nodedatadefaults={title:null,key:null,isFolder:!1,isLazy:!1,tooltip:null,href:null,icon:null,addClass:null,noLink:!1,activate:!1,focus:!1,expand:!1,select:!1,hideCheckbox:!1,unselectable:!1,children:null,lastentry:undefined};f=!1;o=function(){f||(n.ui.plugin.add("draggable","connectToDynatree",{start:function(t,i){var r=n(this).data("draggable"),u=i.helper.data("dtSourceNode")||null;if(u)return r.offset.click.top=-2,r.offset.click.left=16,u.tree._onDragEvent("start",u,null,t,i,r)},drag:function(t,i){var f=n(this).data("draggable"),o=i.helper.data("dtSourceNode")||null,u=i.helper.data("dtTargetNode")||null,r=n.ui.dynatree.getNode(t.target),s;t.target&&!r&&(s=n(t.target).closest("div.dynatree-drag-helper,#dynatree-drop-marker").length>0,s)||(i.helper.data("dtTargetNode",r),u&&u!==r&&u.tree._onDragEvent("leave",u,o,t,i,f),r&&(r.tree.options.dnd.onDrop?r===u?r.tree._onDragEvent("over",r,o,t,i,f):r.tree._onDragEvent("enter",r,o,t,i,f):e()))},stop:function(t,i){var f=n(this).data("draggable"),r=i.helper.data("dtSourceNode")||null,u=i.helper.data("dtTargetNode")||null,s=f._mouseDownEvent,o=t.type,e=o=="mouseup"&&t.which==1;e||logMsg("Drag was cancelled");u&&(e&&u.tree._onDragEvent("drop",u,r,t,i,f),u.tree._onDragEvent("leave",u,r,t,i,f));r&&r.tree._onDragEvent("stop",r,null,t,i,f)}}),f=!0)}})(jQuery);