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