var _canLog=!0;function _log(f){if(_canLog){var k=Array.prototype.slice.apply(arguments,[1]),l=new Date,l=l.getHours()+":"+l.getMinutes()+":"+l.getSeconds()+"."+l.getMilliseconds();k[0]=l+" - "+k[0];try{switch(f){case "info":window.console.info.apply(window.console,k);break;case "warn":window.console.warn.apply(window.console,k);break;default:window.console.log.apply(window.console,k)}}catch(n){window.console||(_canLog=!1)}}} function logMsg(){Array.prototype.unshift.apply(arguments,["debug"]);_log.apply(this,arguments)}var getDynaTreePersistData=null,DTNodeStatus_Error=-1,DTNodeStatus_Loading=1,DTNodeStatus_Ok=0; (function(f){function k(a){for(var b=5;a&&b--;){if(a.dtnode)return a.dtnode;a=a.parentNode}return null}function l(a){var b=a.options.dnd||null;b&&(b.onDragStart||b.onDrop)&&r();b&&b.onDragStart&&a.$tree.draggable({addClasses:!1,appendTo:"body",containment:!1,delay:0,distance:4,revert:!1,connectToDynatree:!0,helper:function(a){var b=k(a.target);return b.tree._onDragEvent("helper",b,null,a,null,null)},_last:null});b&&b.onDrop&&a.$tree.droppable({addClasses:!1,tolerance:"intersect",greedy:!1,_last:null})} var n={create:function(){return function(){this.initialize.apply(this,arguments)}}},o=n.create();o.prototype={initialize:function(a,b,c){this.parent=a;this.tree=b;typeof c==="string"&&(c={title:c});if(c.key===void 0)c.key="_"+b._nodeCount++;this.data=f.extend({},f.ui.dynatree.nodedatadefaults,c);this.childList=this.ul=this.span=this.li=null;this.bSelected=this.bExpanded=this.hasSubSel=this.isLoading=!1},toString:function(){return"DynaTreeNode<"+this.data.key+">: '"+this.data.title+"'"},toDict:function(a, b){var c=f.extend({},this.data);c.activate=this.tree.activeNode===this;c.focus=this.tree.focusNode===this;c.expand=this.bExpanded;c.select=this.bSelected;b&&b(c);if(a&&this.childList){c.children=[];for(var d=0,e=this.childList.length;d1&&(g+=c.tagConnector):g+=this.hasChildren()!==!1?c.tagExpander:c.tagConnector;b.checkbox&&e.hideCheckbox!==!0&&!e.isStatusNode&&(g+=c.tagCheckbox);e.icon?g+="":e.icon===!1||(g+=c.tagNodeIcon);c="";b.onCustomRender&&(c=b.onCustomRender.call(a,this)||"");c||(a=e.tooltip?" title='"+e.tooltip+"'":"",c=b.noLink||e.noLink?""+e.title+"":""+e.title+"");g+=c;return g},_fixOrder:function(){var a=this.childList;if(a&&this.ul)for(var b=this.ul.firstChild,c=0,d=a.length-1;c1?h.container+" "+h.noConnector:h.container;else if(d){if(!this.li){this.li=document.createElement("li");this.li.dtnode=this;if(e.key&&g.generateIds)this.li.id=g.idPrefix+e.key;this.span=document.createElement("span");this.span.className=h.title;this.li.appendChild(this.span);if(!d.ul)d.ul=document.createElement("ul"),d.ul.style.display="none",d.li.appendChild(d.ul);d.ul.appendChild(this.li)}this.span.innerHTML= this._getInnerHtml();var j=[];j.push(h.node);e.isFolder&&j.push(h.folder);this.bExpanded&&j.push(h.expanded);this.hasChildren()!==!1&&j.push(h.hasChildren);e.isLazy&&this.childList===null&&j.push(h.lazy);i&&j.push(h.lastsib);this.bSelected&&j.push(h.selected);this.hasSubSel&&j.push(h.partsel);c.activeNode===this&&j.push(h.active);e.addClass&&j.push(e.addClass);j.push(h.combinedExpanderPrefix+(this.bExpanded?"e":"c")+(e.isLazy&&this.childList===null?"d":"")+(i?"l":""));j.push(h.combinedIconPrefix+ (this.bExpanded?"e":"c")+(e.isFolder?"f":""));this.span.className=j.join(" ");this.li.className=i?h.lastsib:"";g.onRender&&g.onRender.call(c,this,this.span)}if((this.bExpanded||b===!0)&&this.childList){c=0;for(e=this.childList.length;cb.data.title?1:-1};c.sort(a);if(b)for(var d=0,e=c.length;d0?this.childList[0].focus():this.focus());break;case DTNodeStatus_Loading:this.isLoading=!0;f(this.span).addClass(this.tree.options.classNames.nodeLoading);this.parent||this._setStatusNode({title:this.tree.options.strings.loading+d,tooltip:c,addClass:this.tree.options.classNames.nodeWait});break;case DTNodeStatus_Error:this.isLoading= !1;this._setStatusNode({title:this.tree.options.strings.loadError+d,tooltip:c,addClass:this.tree.options.classNames.nodeError});break;default:throw"Bad LazyNodeStatus: '"+a+"'.";}},_parentList:function(a,b){for(var c=[],d=b?this:this.parent;d;)(a||d.parent)&&c.unshift(d),d=d.parent;return c},getLevel:function(){for(var a=0,b=this.parent;b;)a++,b=b.parent;return a},_getTypeForOuterNodeEvent:function(a){var b=this.tree.options.classNames,c=a.target;if(c.className.indexOf(b.node)<0)return null;for(var d= a.pageX-c.offsetLeft,a=a.pageY-c.offsetTop,e=0,g=c.childNodes.length;e=i&&d<=i+s&&a>=j&&a<=j+k)if(f.className==b.title)return"title";else if(f.className==b.expander)return"expander";else if(f.className==b.checkbox)return"checkbox";else if(f.className==b.nodeIcon)return"icon"}return"prefix"},getEventTargetType:function(a){var b=a&&a.target?a.target.className:"",c=this.tree.options.classNames; if(b===c.title)return"title";else if(b===c.expander)return"expander";else if(b===c.checkbox)return"checkbox";else if(b===c.nodeIcon)return"icon";else if(b===c.empty||b===c.vline||b===c.connector)return"prefix";else if(b.indexOf(c.node)>=0)return this._getTypeForOuterNodeEvent(a);return null},isVisible:function(){for(var a=this._parentList(!0,!1),b=0,c=a.length;ba").focus()}catch(a){}},isFocused:function(){return this.tree.tnFocused===this},_activate:function(a,b){this.tree.logDebug("dtnode._activate(%o, fireEvents=%o) - %o",a,b,this);var c=this.tree.options;if(!this.data.isStatusNode&&(!b||!(c.onQueryActivate&&c.onQueryActivate.call(this.tree,a,this)===!1)))if(a){if(this.tree.activeNode){if(this.tree.activeNode===this)return;this.tree.activeNode.deactivate()}c.activeVisible&&this.makeVisible(); this.tree.activeNode=this;c.persist&&f.cookie(c.cookieId+"-active",this.data.key,c.cookie);this.tree.persistence.activeKey=this.data.key;f(this.span).addClass(c.classNames.active);b&&c.onActivate&&c.onActivate.call(this.tree,this)}else if(this.tree.activeNode===this&&!(c.onQueryActivate&&c.onQueryActivate.call(this.tree,!1,this)===!1))f(this.span).removeClass(c.classNames.active),c.persist&&f.cookie(c.cookieId+"-active","",c.cookie),this.tree.persistence.activeKey=null,this.tree.activeNode=null,b&& c.onDeactivate&&c.onDeactivate.call(this.tree,this)},activate:function(){this._activate(!0,!0)},activateSilently:function(){this._activate(!0,!1)},deactivate:function(){this._activate(!1,!0)},isActive:function(){return this.tree.activeNode===this},_userActivate:function(){var a=!0,b=!1;if(this.data.isFolder)switch(this.tree.options.clickFolderMode){case 2:a=!1;b=!0;break;case 3:a=b=!0}this.parent===null&&(b=!1);b&&(this.toggleExpand(),this.focus());a&&this.activate()},_setSubSel:function(a){a?(this.hasSubSel= !0,f(this.span).addClass(this.tree.options.classNames.partsel)):(this.hasSubSel=!1,f(this.span).removeClass(this.tree.options.classNames.partsel))},_fixSelectionState:function(){var a,b,c;if(this.bSelected){this.visit(function(a){a.parent._setSubSel(!0);a._select(!0,!1,!1)});for(a=this.parent;a;){a._setSubSel(!0);var d=!0;b=0;for(c=a.childList.length;b=0;e--)if(c=d[e].getNextSibling())break;c&&c.focus();break;default:b=!1}b&&a.preventDefault()},_onKeypress:function(){},_onFocus:function(a){var b=this.tree.options;if(a.type=="blur"||a.type=="focusout")b.onBlur&&b.onBlur.call(this.tree,this),this.tree.tnFocused&&f(this.tree.tnFocused.span).removeClass(b.classNames.focused), this.tree.tnFocused=null,b.persist&&f.cookie(b.cookieId+"-focus","",b.cookie);else if(a.type=="focus"||a.type=="focusin")this.tree.tnFocused&&this.tree.tnFocused!==this&&(this.tree.logDebug("dtnode.onFocus: out of sync: curFocus: %o",this.tree.tnFocused),f(this.tree.tnFocused.span).removeClass(b.classNames.focused)),this.tree.tnFocused=this,b.onFocus&&b.onFocus.call(this.tree,this),f(this.tree.tnFocused.span).addClass(b.classNames.focused),b.persist&&f.cookie(b.cookieId+"-focus",this.data.key,b.cookie)}, visit:function(a,b){var c=!0;if(b===!0&&(c=a(this),c===!1||c=="skip"))return c;if(this.childList)for(var d=0,e=this.childList.length;d reloading %s...",this,a,i);var j=this;i.reloadChildren(function(e,f){f?(c.logDebug("%s._loadKeyPath(%s) -> reloaded %s.",e,a,e),b.call(c,i,"loaded"),e._loadKeyPath(d.join(c.options.keyPathSeparator), b)):(c.logWarning("%s._loadKeyPath(%s) -> reloadChildren() failed.",j,a),b.call(c,i,"error"))})}else b.call(c,i,"loaded"),i._loadKeyPath(d.join(c.options.keyPathSeparator),b);return}}c.logWarning("Node not found: "+e)},resetLazy:function(){if(this.parent===null)throw"Use tree.reload() instead";else if(!this.data.isLazy)throw"node.resetLazy() requires lazy nodes.";this.expand(!1);this.removeChildren()},_addChildNode:function(a,b){var c=this.tree,d=c.options,e=c.persistence;a.parent=this;this.childList=== null?this.childList=[]:b||this.childList.length>0&&f(this.childList[this.childList.length-1].span).removeClass(d.classNames.lastsib);if(b){var g=f.inArray(b,this.childList);if(g<0)throw" must be a child of ";this.childList.splice(g,0,a)}else this.childList.push(a);g=c.isInitializing();if(d.persist&&e.cookiesFound&&g){if(e.activeKey==a.data.key)c.activeNode=a;if(e.focusedKey==a.data.key)c.focusNode=a;a.bExpanded=f.inArray(a.data.key,e.expandedKeyList)>=0;a.bSelected=f.inArray(a.data.key, e.selectedKeyList)>=0}else{if(a.data.activate&&(c.activeNode=a,d.persist))e.activeKey=a.data.key;if(a.data.focus&&(c.focusNode=a,d.persist))e.focusedKey=a.data.key;a.bExpanded=a.data.expand===!0;a.bExpanded&&d.persist&&e.addExpand(a.data.key);a.bSelected=a.data.select===!0;a.bSelected&&d.persist&&e.addSelect(a.data.key)}if(d.minExpandLevel>=a.getLevel())this.bExpanded=!0;if(a.bSelected&&d.selectMode==3)for(d=this;d;)d.hasSubSel||d._setSubSel(!0),d=d.parent;c.bEnableUpdate&&this.render();return a}, addChild:function(a,b){if(typeof a=="string")throw"Invalid data type for "+a;else if(!a||a.length===0)return;else if(a instanceof o)return this._addChildNode(a,b);a.length||(a=[a]);for(var c=this.tree.enableUpdate(!1),d=null,e=0,f=a.length;e=0&&(this.expandedKeyList.splice(a,1),f.cookie(this.cookieId+"-expand",this.expandedKeyList.join(","),this.cookieOpts))},addSelect:function(a){f.inArray(a,this.selectedKeyList)<0&&(this.selectedKeyList.push(a),f.cookie(this.cookieId+"-select",this.selectedKeyList.join(","),this.cookieOpts))},clearSelect:function(a){a=f.inArray(a,this.selectedKeyList);a>= 0&&(this.selectedKeyList.splice(a,1),f.cookie(this.cookieId+"-select",this.selectedKeyList.join(","),this.cookieOpts))},isReloading:function(){return this.cookiesFound===!0},toDict:function(){return{cookiesFound:this.cookiesFound,activeKey:this.activeKey,focusedKey:this.activeKey,expandedKeyList:this.expandedKeyList,selectedKeyList:this.selectedKeyList}},lastentry:void 0};var p=n.create();p.version="$Version:$";p.prototype={initialize:function(a){this.phase="init";this.$widget=a;this.options=a.options; this.$tree=a.element;this.timer=null;this.divTree=this.$tree.get(0);l(this)},_load:function(a){var b=this.options,c=this;this.bEnableUpdate=!0;this._nodeCount=1;this.focusNode=this.activeNode=null;b.rootVisible!==void 0&&this.logWarning("Option 'rootVisible' is no longer supported.");if(b.minExpandLevel<1)this.logWarning("Option 'minExpandLevel' must be >= 1."),b.minExpandLevel=1;if(b.classNames!==f.ui.dynatree.prototype.options.classNames)b.classNames=f.extend({},f.ui.dynatree.prototype.options.classNames, b.classNames);if(b.ajaxDefaults!==f.ui.dynatree.prototype.options.ajaxDefaults)b.ajaxDefaults=f.extend({},f.ui.dynatree.prototype.options.ajaxDefaults,b.ajaxDefaults);if(b.dnd!==f.ui.dynatree.prototype.options.dnd)b.dnd=f.extend({},f.ui.dynatree.prototype.options.dnd,b.dnd);b.imagePath||f("script").each(function(){if(this.src.search(/.*dynatree[^\/]*\.js$/i)>=0)return b.imagePath=this.src.indexOf("/")>=0?this.src.slice(0,this.src.lastIndexOf("/"))+"/skin/":"skin/",c.logDebug("Guessing imagePath from '%s': '%s'", this.src,b.imagePath),!1});this.persistence=new m(b.cookieId,b.cookie);b.persist&&(f.cookie||_log("warn","Please include jquery.cookie.js to use persistence."),this.persistence.read());this.logDebug("DynaTree.persistence: %o",this.persistence.toDict());this.cache={tagEmpty:"",tagVline:"",tagExpander:"",tagConnector:"", tagNodeIcon:"",tagCheckbox:"",lastentry:void 0};(b.children||b.initAjax&&b.initAjax.url||b.initId)&&f(this.divTree).empty();var d=this.$tree.find(">ul:first").hide();this.tnRoot=new o(null,this,{});this.tnRoot.bExpanded=!0;this.tnRoot.render();this.divTree.appendChild(this.tnRoot.ul);var e=this.tnRoot,g=b.persist&&this.persistence.isReloading(),h=!1,i=this.enableUpdate(!1);this.logDebug("Dynatree._load(): read tree structure..."); b.children?e.addChild(b.children):b.initAjax&&b.initAjax.url?(h=!0,e.data.isLazy=!0,this._reloadAjax(a)):b.initId?this._createFromTag(e,f("#"+b.initId)):(this._createFromTag(e,d),d.remove());this._checkConsistency();this.logDebug("Dynatree._load(): render nodes...");this.enableUpdate(i);this.logDebug("Dynatree._load(): bind events...");this.$widget.bind();this.logDebug("Dynatree._load(): postInit...");this.phase="postInit";b.persist&&this.persistence.write();this.focusNode&&this.focusNode.isVisible()&& (this.logDebug("Focus on init: %o",this.focusNode),this.focusNode.focus());!h&&b.onPostInit&&b.onPostInit.call(this,g,!1);this.phase="idle"},_reloadAjax:function(a){var b=this.options;if(!b.initAjax||!b.initAjax.url)throw"tree.reload() requires 'initAjax' mode.";var c=this.persistence,d=f.extend({},b.initAjax);if(d.addActiveKey)d.data.activeKey=c.activeKey;if(d.addFocusedKey)d.data.focusedKey=c.focusedKey;if(d.addExpandedKeyList)d.data.expandedKeyList=c.expandedKeyList.join(",");if(d.addSelectedKeyList)d.data.selectedKeyList= c.selectedKeyList.join(",");if(b.onPostInit){d.success&&this.logWarning("initAjax: success callback is ignored when onPostInit was specified.");d.error&&this.logWarning("initAjax: error callback is ignored when onPostInit was specified.");var e=c.isReloading();d.success=function(c){b.onPostInit.call(c.tree,e,!1);a&&a.call(c.tree,"ok")};d.error=function(c){b.onPostInit.call(c.tree,e,!0);a&&a.call(c.tree,"error")}}this.logDebug("Dynatree._init(): send Ajax request...");this.tnRoot.appendAjax(d)},toString:function(){return"Dynatree '"+ this.$tree.attr("id")+"'"},toDict:function(){return this.tnRoot.toDict(!0)},serializeArray:function(a){for(var a=this.getSelectedNodes(a),b=this.$tree.attr("name")||this.$tree.attr("id"),c=[],d=0,e=a.length;d=2&&(Array.prototype.unshift.apply(arguments,["debug"]),_log.apply(this,arguments))},logInfo:function(){this.options.debugLevel>=1&&(Array.prototype.unshift.apply(arguments, ["info"]),_log.apply(this,arguments))},logWarning:function(){Array.prototype.unshift.apply(arguments,["warn"]);_log.apply(this,arguments)},isInitializing:function(){return this.phase=="init"||this.phase=="postInit"},isReloading:function(){return(this.phase=="init"||this.phase=="postInit")&&this.options.persist&&this.persistence.cookiesFound},isUserEvent:function(){return this.phase=="userEvent"},redraw:function(){this.tnRoot.render(!1,!1)},renderInvisibleNodes:function(){this.tnRoot.render(!1,!0)}, reload:function(a){this._load(a)},getRoot:function(){return this.tnRoot},enable:function(){this.$widget.enable()},disable:function(){this.$widget.disable()},getNodeByKey:function(a){var b=document.getElementById(this.options.idPrefix+a);if(b)return b.dtnode?b.dtnode:null;var c=null;this.visit(function(b){if(b.data.key==a)return c=b,!1},!0);return c},getActiveNode:function(){return this.activeNode},reactivate:function(a){var b=this.activeNode;if(b)this.activeNode=null,b.activate(),a&&b.focus()},getSelectedNodes:function(a){var b= [];this.tnRoot.visit(function(c){if(c.bSelected&&(b.push(c),a===!0))return"skip"});return b},activateKey:function(a){a=a===null?null:this.getNodeByKey(a);if(!a)return this.activeNode&&this.activeNode.deactivate(),this.activeNode=null;a.focus();a.activate();return a},loadKeyPath:function(a,b){var c=a.split(this.options.keyPathSeparator);c[0]===""&&c.shift();c[0]==this.tnRoot.data.key&&(this.logDebug("Removed leading root key."),c.shift());a=c.join(this.options.keyPathSeparator);return this.tnRoot._loadKeyPath(a, b)},selectKey:function(a,b){var c=this.getNodeByKey(a);if(!c)return null;c.select(b);return c},enableUpdate:function(a){if(this.bEnableUpdate==a)return a;(this.bEnableUpdate=a)&&this.redraw();return!a},count:function(){return this.tnRoot.countChildren()},visit:function(a,b){return this.tnRoot.visit(a,b)},_createFromTag:function(a,b){var c=this;b.find(">li").each(function(){var b=f(this),e=b.find(">span:first"),g=b.find(">a:first"),h=null,i=null;e.length?e=e.html():g.length?(e=g.html(),h=g.attr("href"), i=g.attr("target")):(e=b.html(),g=e.search(/
    =0?f.trim(e.substring(0,g)):f.trim(e));g={title:e,isFolder:b.hasClass("folder"),isLazy:b.hasClass("lazy"),expand:b.hasClass("expanded"),select:b.hasClass("selected"),activate:b.hasClass("active"),focus:b.hasClass("focused"),noLink:b.hasClass("noLink")};if(h)g.href=h,g.target=i;if(b.attr("title"))g.tooltip=b.attr("title");if(b.attr("id"))g.key=b.attr("id");if(b.attr("data")&&(h=f.trim(b.attr("data")))){h.charAt(0)!="{"&&(h="{"+h+"}");try{f.extend(g, eval("("+h+")"))}catch(j){throw"Error parsing node data: "+j+"\ndata:\n'"+h+"'";}}h=a.addChild(g);b=b.find(">ul:first");b.length&&c._createFromTag(h,b)})},_checkConsistency:function(){},_setDndStatus:function(a,b,c,d,e){a=a?f(a.span):null;b=f(b.span);if(!this.$dndMarker)this.$dndMarker=f("
    ").hide().prependTo(f(this.divTree).parent());if(d==="after"||d==="before"||d==="over"){var g=b.position();switch(d){case "before":this.$dndMarker.removeClass("dynatree-drop-after dynatree-drop-over"); this.$dndMarker.addClass("dynatree-drop-before");g.top-=8;break;case "after":this.$dndMarker.removeClass("dynatree-drop-before dynatree-drop-over");this.$dndMarker.addClass("dynatree-drop-after");g.top+=8;break;default:this.$dndMarker.removeClass("dynatree-drop-after dynatree-drop-before"),this.$dndMarker.addClass("dynatree-drop-over"),b.addClass("dynatree-drop-target"),g.left+=8}this.$dndMarker.css({left:g.left+"px",top:g.top+"px"}).show()}else b.removeClass("dynatree-drop-target"),this.$dndMarker.hide(); d==="after"?b.addClass("dynatree-drop-after"):b.removeClass("dynatree-drop-after");d==="before"?b.addClass("dynatree-drop-before"):b.removeClass("dynatree-drop-before");e===!0?(a&&a.addClass("dynatree-drop-accept"),b.addClass("dynatree-drop-accept"),c.addClass("dynatree-drop-accept")):(a&&a.removeClass("dynatree-drop-accept"),b.removeClass("dynatree-drop-accept"),c.removeClass("dynatree-drop-accept"));e===!1?(a&&a.addClass("dynatree-drop-reject"),b.addClass("dynatree-drop-reject"),c.addClass("dynatree-drop-reject")): (a&&a.removeClass("dynatree-drop-reject"),b.removeClass("dynatree-drop-reject"),c.removeClass("dynatree-drop-reject"))},_onDragEvent:function(a,b,c,d,e,g){var h=this.options.dnd,i=null,j=f(b.span);switch(a){case "helper":c=f("
    ").append(f(d.target).closest("a").clone());c.data("dtSourceNode",b);i=c;break;case "start":b.isStatusNode()?i=!1:h.onDragStart&&(i=h.onDragStart(b));i===!1?(this.logDebug("tree.onDragStart() cancelled"), e.helper.trigger("mouseup"),e.helper.hide()):j.addClass("dynatree-drag-source");break;case "enter":i=h.onDragEnter?h.onDragEnter(b,c):null;i={over:i!==!1&&(i===!0||i==="over"||f.inArray("over",i)>=0),before:i!==!1&&(i===!0||i==="before"||f.inArray("before",i)>=0),after:i!==!1&&(i===!0||i==="after"||f.inArray("after",i)>=0)};e.helper.data("enterResponse",i);break;case "over":g=e.helper.data("enterResponse");a=null;if(g===!1)break;else if(typeof g==="string")a=g;else{var k=j.offset(),d={x:d.pageX-k.left, y:d.pageY-k.top},j={x:d.x/j.width(),y:d.y/j.height()};g.after&&j.y>0.75?a="after":!g.over&&g.after&&j.y>0.5?a="after":g.before&&j.y<=0.25?a="before":!g.over&&g.before&&j.y<=0.5?a="before":g.over&&(a="over");h.preventVoidMoves&&(b===c?a=null:a==="before"&&c&&b===c.getNextSibling()?a=null:a==="after"&&c&&b===c.getPrevSibling()?a=null:a==="over"&&c&&c.parent===b&&c.isLastSibling()&&(a=null));e.helper.data("hitMode",a)}a==="over"&&h.autoExpandMS&&b.hasChildren()!==!1&&!b.bExpanded&&b.scheduleAction("expand", h.autoExpandMS);a&&h.onDragOver&&(i=h.onDragOver(b,c,a));this._setDndStatus(c,b,e.helper,a,i!==!1);break;case "drop":if((a=e.helper.data("hitMode"))&&h.onDrop)h.onDrop(b,c,a,e,g);break;case "leave":b.scheduleAction("cancel");e.helper.data("enterResponse",null);e.helper.data("hitMode",null);this._setDndStatus(c,b,e.helper,"out",void 0);if(h.onDragLeave)h.onDragLeave(b,c);break;case "stop":j.removeClass("dynatree-drag-source");if(h.onDragStop)h.onDragStop(b);break;default:throw"Unsupported drag event: "+ a;}return i},cancelDrag:function(){var a=f.ui.ddmanager.current;a&&a.cancel()},lastentry:void 0};f.widget("ui.dynatree",{_init:function(){if(parseFloat(f.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(){this.options.debugLevel>=1&&logMsg("Dynatree._create(): version='%s', debugLevel=%o.", p.version,this.options.debugLevel);this.options.event+=".dynatree";this.element.get(0);this.tree=new p(this);this.tree._load();this.tree.logDebug("Dynatree._init(): done.")},bind:function(){function a(a){var a=f.event.fix(a||window.event),b=k(a.target);return b?b._onFocus(a):!1}this.unbind();var b="click.dynatree dblclick.dynatree";this.options.keyboard&&(b+=" keypress.dynatree keydown.dynatree");this.element.bind(b,function(a){var b=k(a.target);if(!b)return!0;var e=b.tree,f=e.options;e.logDebug("event(%s): dtnode: %s", a.type,b);var h=e.phase;e.phase="userEvent";try{switch(a.type){case "click":return f.onClick&&f.onClick.call(e,b,a)===!1?!1:b._onClick(a);case "dblclick":return f.onDblClick&&f.onDblClick.call(e,b,a)===!1?!1:b._onDblClick(a);case "keydown":return f.onKeydown&&f.onKeydown.call(e,b,a)===!1?!1:b._onKeydown(a);case "keypress":return f.onKeypress&&f.onKeypress.call(e,b,a)===!1?!1:b._onKeypress(a)}}catch(i){e.logWarning("bind(%o): dtnode: %o, error: %o",a,b,i)}finally{e.phase=h}});b=this.tree.divTree;b.addEventListener? (b.addEventListener("focus",a,!0),b.addEventListener("blur",a,!0)):b.onfocusin=b.onfocusout=a},unbind:function(){this.element.unbind(".dynatree")},enable:function(){this.bind();f.Widget.prototype.enable.apply(this,arguments)},disable:function(){this.unbind();f.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:void 0});if(parseFloat(f.ui.version)<1.8)f.ui.dynatree.getter="getTree getRoot getActiveNode getSelectedNodes";f.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,onRender:null,dnd:{onDragStart:null,onDragStop:null,autoExpandMS:1E3,preventVoidMoves:!0,onDragEnter:null,onDragOver:null,onDrop:null,onDragLeave:null},ajaxDefaults:{cache:!1,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:2,lastentry:void 0};if(parseFloat(f.ui.version)<1.8)f.ui.dynatree.defaults=f.ui.dynatree.prototype.options;f.ui.dynatree.nodedatadefaults={title:null,key:null,isFolder:!1,isLazy:!1,tooltip:null,icon:null,addClass:null,noLink:!1,activate:!1,focus:!1,expand:!1,select:!1,hideCheckbox:!1,unselectable:!1,children:null, lastentry:void 0};var q=!1,r=function(){q||(f.ui.plugin.add("draggable","connectToDynatree",{start:function(a,b){var c=f(this).data("draggable"),d=b.helper.data("dtSourceNode")||null;if(d)return c.offset.click.top=-2,c.offset.click.left=16,d.tree._onDragEvent("start",d,null,a,b,c)},drag:function(a,b){var c=f(this).data("draggable"),d=b.helper.data("dtSourceNode")||null,e=b.helper.data("dtTargetNode")||null,g=k(a.target);a.target&&!g&&f(a.target).closest("div.dynatree-drag-helper,#dynatree-drop-marker").length> 0||(b.helper.data("dtTargetNode",g),e&&e!==g&&e.tree._onDragEvent("leave",e,d,a,b,c),g&&g.tree.options.dnd.onDrop&&(g===e?g.tree._onDragEvent("over",g,d,a,b,c):g.tree._onDragEvent("enter",g,d,a,b,c)))},stop:function(a,b){var c=f(this).data("draggable"),d=b.helper.data("dtSourceNode")||null,e=b.helper.data("dtTargetNode")||null,g=a.type=="mouseup"&&a.which==1;g||logMsg("Drag was cancelled");e&&(g&&e.tree._onDragEvent("drop",e,d,a,b,c),e.tree._onDragEvent("leave",e,d,a,b,c));d&&d.tree._onDragEvent("stop", d,null,a,b,c)}}),q=!0)}})(jQuery);