Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
/*! jQuery Dynatree Plugin - v1.2.2 - 2012-10-07
* http://dynatree.googlecode.com/
* Copyright (c) 2012 Martin Wendt; Licensed MIT, GPL */
function _log(a,b){if(!_canLog)return;var c=Array.prototype.slice.apply(arguments,[1]),d=new Date,e=d.getHours()+":"+d.getMinutes()+":"+d.getSeconds()+"."+d.getMilliseconds();c[0]=e+" - "+c[0];try{switch(a){case"info":window.console.info.apply(window.console,c);break;case"warn":window.console.warn.apply(window.console,c);break;default:window.console.log.apply(window.console,c)}}catch(f){window.console||(_canLog=!1)}}function logMsg(a){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 getDtNodeFromElement(a){return alert("getDtNodeFromElement is deprecated"),$.ui.dynatree.getNode(a)}function noop(){}function _initDragAndDrop(a){var b=a.options.dnd||null;b&&(b.onDragStart||b.onDrop)&&_registerDnd(),b&&b.onDragStart&&a.$tree.draggable({addClasses:!1,appendTo:"body",containment:!1,delay:0,distance:4,revert:!1,scroll:!0,scrollSpeed:7,scrollSensitivity:10,connectToDynatree:!0,helper:function(a){var b=$.ui.dynatree.getNode(a.target);return b?b.tree._onDragEvent("helper",b,null,a,null,null):"<div></div>"},start:function(a,b){var c=b.helper.data("dtSourceNode");return!!c},_last:null}),b&&b.onDrop&&a.$tree.droppable({addClasses:!1,tolerance:"intersect",greedy:!1,_last:null})}var Class={create:function(){return function(){this.initialize.apply(this,arguments)}}},DynaTreeNode=Class.create();DynaTreeNode.prototype={initialize:function(a,b,c){this.parent=a,this.tree=b,typeof c=="string"&&(c={title:c}),c.key===undefined&&(c.key="_"+b._nodeCount++),this.data=$.extend({},$.ui.dynatree.nodedatadefaults,c),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(a,b){var c=$.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;d<e;d++)c.children.push(this.childList[d].toDict(!0,b))}else delete c.children;return c},fromDict:function(a){var b=a.children;if(b===undefined){this.data=$.extend(this.data,a),this.render();return}a=$.extend({},a),a.children=undefined,this.data=$.extend(this.data,a),this.removeChildren(),this.addChild(b)},_getInnerHtml:function(){var a=this.tree,b=a.options,c=a.cache,d=this.getLevel(),e=this.data,f="",g;d<b.minExpandLevel?d>1&&(f+=c.tagConnector):this.hasChildren()!==!1?f+=c.tagExpander:f+=c.tagConnector,b.checkbox&&e.hideCheckbox!==!0&&!e.isStatusNode&&(f+=c.tagCheckbox),e.icon?(e.icon.charAt(0)==="/"?g=e.icon:g=b.imagePath+e.icon,f+="<img src='"+g+"' alt='' />"):e.icon!==!1&&(f+=c.tagNodeIcon);var h="";b.onCustomRender&&(h=b.onCustomRender.call(a,this)||"");if(!h){var i=e.tooltip?' title="'+e.tooltip.replace(/\"/g,"&quot;")+'"':"",j=e.href||"#";b.noLink||e.noLink?h='<span style="display:inline-block;" class="'+b.classNames.title+'"'+i+">"+e.title+"</span>":h='<a href="'+j+'" class="'+b.classNames.title+'"'+i+">"+e.title+"</a>"}return f+=h,f},_fixOrder:function(){var a=this.childList;if(!a||!this.ul)return;var b=this.ul.firstChild;for(var c=0,d=a.length-1;c<d;c++){var e=a[c],f=b.dtnode;e!==f?(this.tree.logDebug("_fixOrder: mismatch at index "+c+": "+e+" != "+f),this.ul.insertBefore(e.li,f.li)):b=b.nextSibling}},render:function(a,b){var c=this.tree,d=this.parent,e=this.data,f=c.options,g=f.classNames,h=this.isLastSibling(),i=!1;if(!d&&!this.ul)this.li=this.span=null,this.ul=document.createElement("ul"),f.minExpandLevel>1?this.ul.className=g.container+" "+g.noConnector:this.ul.className=g.container;else if(d){this.li||(i=!0,this.li=document.createElement("li"),this.li.dtnode=this,e.key&&f.generateIds&&(this.li.id=f.idPrefix+e.key),this.span=document.createElement("span"),this.span.className=g.title,this.li.appendChild(this.span),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(g.node),e.isFolder&&j.push(g.folder),this.bExpanded&&j.push(g.expanded),this.hasChildren()!==!1&&j.push(g.hasChildren),e.isLazy&&this.childList===null&&j.push(g.lazy),h&&j.push(g.lastsib),this.bSelected&&j.push(g.selected),this.hasSubSel&&j.push(g.partsel),c.activeNode===this&&j.push(g.active),e.addClass&&j.push(e.addClass),j.push(g.combinedExpanderPrefix+(this.bExpanded?"e":"c")+(e.isLazy&&this.childList===null?"d":"")+(h?"l":"")),j.push(g.combinedIconPrefix+(this.bExpanded?"e":"c")+(e.isFolder?"f":"")),this.span.className=j.join(" "),this.li.className=h?g.lastsib:"",i&&f.onCreate&&f.onCreate.call(c,this,this.span),f.onRender&&f.onRender.call(c,this,this.span)}if((this.bExpanded||b===!0)&&this.childList){for(var k=0,l=this.childList.length;k<l;k++)this.childList[k].render(!1,b);this._fixOrder()}if(this.ul){var m=this.ul.style.display==="none",n=!!this.bExpanded;if(a&&f.fx&&m===n){var o=f.fx.duration||200;$(this.ul).animate(f.fx,o)}else this.ul.style.display=this.bExpanded||!d?"":"none"}},getKeyPath:function(a){var b=[];return this.visitParents(function(a){a.parent&&b.unshift(a.data.key)},!a),"/"+b.join(this.tree.options.keyPathSeparator)},getParent:function(){return this.parent},getChildren:function(){return this.hasChildren()===undefined?undefined:this.childList},hasChildren:function(){if(this.data.isLazy)return this.childList===null||this.childList===undefined?undefined:this.childList.length===0?!1:this.childList.length===1&&this.childList[0].isStatusNode()?undefined:!0;return!!this.childList},isFirstSibling:function(){var a=this.parent;return!a||a.childList[0]===this},isLastSibling:function(){var a=this.parent;return!a||a.childList[a.childList.length-1]===this},isLoading:function(){return!!this._isLoading},getPrevSibling:function(){if(!this.parent)return null;var a=this.parent.childList;for(var b=1,c=a.length;b<c;b++)if(a[b]===this)return a[b-1];return null},getNextSibling:function(){if(!this.parent)return null;var a=this.parent.childList;for(var b=0,c=a.length-1;b<c;b++)if(a[b]===this)return a[b+1];return null},isStatusNode:function(){return this.data.isStatusNode===!0},isChildOf:function(a){return this.parent&&this.parent===a},isDescendantOf:function(a){if(!a)return!1;var b=this.parent;while(b){if(b===a)return!0;b=b.parent}return!1},countChildren:function(){var a=this.childList;if(!a)return 0;var b=a.length;for(var c=0,d=b;c<d;c++){var e=a[c];b+=e.countChildren()}return b},sortChildren:function(a,b){var c=this.childList;if(!c)return;a=a||function(a,b){var c=a.data.title.toLowerCase(),d=b.data.title.toLowerCase();return c===d?0:c>d?1:-1},c.sort(a);if(b)for(var d=0,e=c.length;d<e;d++)c[d].childList&&c[d].sortChildren(a,"$norender$");b!=="$norender$"&&this.render()},_setStatusNode:function(a){var b=this.childList?this.childList[0]:null;if(!a){if(b&&b.isStatusNode()){try{this.ul&&(this.ul.removeChild(b.li),b.li=null)}catch(c){}this.childList.length===1?this.childList=[]:this.childList.shift()}}else b?(a.isStatusNode=!0,a.key="_statusNode",b.data=a,b.render()):(a.isStatusNode=!0,a.key="_statusNode",b=this.addChild(a))},setLazyNodeStatus:function(a,b){var c=b&&b.tooltip?b.tooltip:null,d=b&&b.info?" ("+b.info+")":"";switch(a){case DTNodeStatus_Ok:this._setStatusNode(null),$(this.span).removeClass(this.tree.options.classNames.nodeLoading),this._isLoading=!1,this.tree.options.autoFocus&&(this===this.tree.tnRoot&&this.childList&&this.childList.length>0?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+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){var c=[],d=b?this:this.parent;while(d)(a||d.parent)&&c.unshift(d),d=d.parent;return c},getLevel:function(){var a=0,b=this.parent;while(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;var d=a.pageX-c.offsetLeft,e=a.pageY-c.offsetTop;for(var f=0,g=c.childNodes.length;f<g;f++){var h=c.childNodes[f],i=h.offsetLeft-c.offsetLeft,j=h.offsetTop-c.offsetTop,k=h.clientWidth,l=h.clientHeight;if(d>=i&&d<=i+k&&e>=j&&e<=j+l){if(h.className==b.title)return"title";if(h.className==b.expander)return"expander";if(h.className==b.checkbox)return"checkbox";if(h.className==b.nodeIcon)return"icon"}}return"prefix"},getEventTargetType:function(a){var b=a&&a.target?a.target.className:"",c=this.tree.options.classNames;return b===c.title?"title":b===c.expander?"expander":b===c.checkbox?"checkbox":b===c.nodeIcon?"icon":b===c.empty||b===c.vline||b===c.connector?"prefix":b.indexOf(c.node)>=0?this._getTypeForOuterNodeEvent(a):null},isVisible:function(){var a=this._parentList(!0,!1);for(var b=0,c=a.length;b<c;b++)if(!a[b].bExpanded)return!1;return!0},makeVisible:function(){var a=this._parentList(!0,!1);for(var b=0,c=a.length;b<c;b++)a[b]._expand(!0)},focus:function(){this.makeVisible();try{$(this.span).find(">a").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)return;if(b&&c.onQueryActivate&&c.onQueryActivate.call(this.tree,a,this)===!1)return;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&&$.cookie(c.cookieId+"-active",this.data.key,c.cookie),this.tree.persistence.activeKey=this.data.key,$(this.span).addClass(c.classNames.active),b&&c.onActivate&&c.onActivate.call(this.tree,this)}else if(this.tree.activeNode===this){if(c.onQueryActivate&&c.onQueryActivate.call(this.tree,!1,this)===!1)return;$(this.span).removeClass(c.classNames.active),c.persist&&$.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,$(this.span).addClass(this.tree.options.classNames.partsel)):(this.hasSubSel=!1,$(this.span).removeClass(this.tree.options.classNames.partsel))},_updatePartSelectionState:function(){var a;if(!this.hasChildren())return a=this.bSelected&&!this.data.unselectable&&!this.data.isStatusNode,this._setSubSel(!1),a;var b,c,d=this.childList,e=!0,f=!0;for(b=0,c=d.length;b<c;b++){var g=d[b],h=g._updatePartSelectionState();h!==!1&&(f=!1),h!==!0&&(e=!1)}return e?a=!0:f?a=!1:a=undefined,this._setSubSel(a===undefined),this.bSelected=a===!0,a},_fixSelectionState:function(){var a,b,c;if(this.bSelected){this.visit(function(a){a.parent._setSubSel(!0),a.data.unselectable||a._select(!0,!1,!1)}),a=this.parent;while(a){a._setSubSel(!0);var d=!0;for(b=0,c=a.childList.length;b<c;b++){var e=a.childList[b];if(!e.bSelected&&!e.data.isStatusNode&&!e.data.unselectable){d=!1;break}}d&&a._select(!0,!1,!1),a=a.parent}}else{this._setSubSel(!1),this.visit(function(a){a._setSubSel(!1),a._select(!1,!1,!1)}),a=this.parent;while(a){a._select(!1,!1,!1);var f=!1;for(b=0,c=a.childList.length;b<c;b++)if(a.childList[b].bSelected||a.childList[b].hasSubSel){f=!0;break}a._setSubSel(f),a=a.parent}}},_select:function(a,b,c){var d=this.tree.options;if(this.data.isStatusNode)return;if(this.bSelected===a)return;if(b&&d.onQuerySelect&&d.onQuerySelect.call(this.tree,a,this)===!1)return;d.selectMode==1&&a&&this.tree.visit(function(a){if(a.bSelected)return a._select(!1,!1,!1),!1}),this.bSelected=a,a?(d.persist&&this.tree.persistence.addSelect(this.data.key),$(this.span).addClass(d.classNames.selected),c&&d.selectMode===3&&this._fixSelectionState(),b&&d.onSelect&&d.onSelect.call(this.tree,!0,this)):(d.persist&&this.tree.persistence.clearSelect(this.data.key),$(this.span).removeClass(d.classNames.selected),c&&d.selectMode===3&&this._fixSelectionState(),b&&d.onSelect&&d.onSelect.call(this.tree,!1,this))},select:function(a){return this.data.unselectable?this.bSelected:this._select(a!==!1,!0,!0)},toggleSelect:function(){return this.select(!this.bSelected)},isSelected:function(){return this.bSelected},isLazy:function(){return!!this.data.isLazy},_loadContent:function(){try{var a=this.tree.options;this.tree.logDebug("_loadContent: start - %o",this),this.setLazyNodeStatus(DTNodeStatus_Loading),!0===a.onLazyRead.call(this.tree,this)&&(this.setLazyNodeStatus(DTNodeStatus_Ok),this.tree.logDebug("_loadContent: succeeded - %o",this))}catch(b){this.tree.logWarning("_loadContent: failed - %o",b),this.setLazyNodeStatus(DTNodeStatus_Error,{tooltip:""+b})}},_expand:function(a,b){if(this.bExpanded===a){this.tree.logDebug("dtnode._expand(%o) IGNORED - %o",a,this);return}this.tree.logDebug("dtnode._expand(%o) - %o",a,this);var c=this.tree.options;if(!a&&this.getLevel()<c.minExpandLevel){this.tree.logDebug("dtnode._expand(%o) prevented collapse - %o",a,this);return}if(c.onQueryExpand&&c.onQueryExpand.call(this.tree,a,this)===!1)return;this.bExpanded=a,c.persist&&(a?this.tree.persistence.addExpand(this.data.key):this.tree.persistence.clearExpand(this.data.key));var d=(!this.data.isLazy||this.childList!==null)&&!this._isLoading&&!b;this.render(d);if(this.bExpanded&&this.parent&&c.autoCollapse){var e=this._parentList(!1,!0);for(var f=0,g=e.length;f<g;f++)e[f].collapseSiblings()}c.activeVisible&&this.tree.activeNode&&!this.tree.activeNode.isVisible()&&this.tree.activeNode.deactivate();if(a&&this.data.isLazy&&this.childList===null&&!this._isLoading){this._loadContent();return}c.onExpand&&c.onExpand.call(this.tree,a,this)},isExpanded:function(){return this.bExpanded},expand:function(a){a=a!==!1;if(!this.childList&&!this.data.isLazy&&a)return;if(this.parent===null&&!a)return;this._expand(a)},scheduleAction:function(a,b){this.tree.timer&&(clearTimeout(this.tree.timer),this.tree.logDebug("clearTimeout(%o)",this.tree.timer));var c=this;switch(a){case"cancel":break;case"expand":this.tree.timer=setTimeout(function(){c.tree.logDebug("setTimeout: trigger expand"),c.expand(!0)},b);break;case"activate":this.tree.timer=setTimeout(function(){c.tree.logDebug("setTimeout: trigger activate"),c.activate()},b);break;default:throw"Invalid mode "+a}this.tree.logDebug("setTimeout(%s, %s): %s",a,b,this.tree.timer)},toggleExpand:function(){this.expand(!this.bExpanded)},collapseSiblings:function(){if(this.parent===null)return;var a=this.parent.childList;for(var b=0,c=a.length;b<c;b++)a[b]!==this&&a[b].bExpanded&&a[b]._expand(!1)},_onClick:function(a){var b=this.getEventTargetType(a);if(b==="expander")this.toggleExpand(),this.focus();else if(b==="checkbox")this.toggleSelect(),this.focus();else{this._userActivate();var c=this.span.getElementsByTagName("a");if(c[0])$.browser.msie&&parseInt($.browser.version,10)<9||c[0].focus();else return!0}a.preventDefault()},_onDblClick:function(a){},_onKeydown:function(a){var b=!0,c;switch(a.which){case 107:case 187:this.bExpanded||this.toggleExpand();break;case 109:case 189:this.bExpanded&&this.toggleExpand();break;case 32:this._userActivate();break;case 8:this.parent&&this.parent.focus();break;case 37:this.bExpanded?(this.toggleExpand(),this.focus()):this.parent&&this.parent.parent&&this.parent.focus();break;case 39:!this.bExpanded&&(this.childList||this.data.isLazy)?(this.toggleExpand(),this.focus()):this.childList&&this.childList[0].focus();break;case 38:c=this.getPrevSibling();while(c&&c.bExpanded&&c.childList)c=c.childList[c.childList.length-1];!c&&this.parent&&this.parent.parent&&(c=this.parent),c&&c.focus();break;case 40:if(this.bExpanded&&this.childList)c=this.childList[0];else{var d=this._parentList(!1,!0);for(var e=d.length-1;e>=0;e--){c=d[e].getNextSibling();if(c)break}}c&&c.focus();break;default:b=!1}b&&a.preventDefault()},_onKeypress:function(a){},_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&&$(this.tree.tnFocused.span).removeClass(b.classNames.focused),this.tree.tnFocused=null,b.persist&&$.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),$(this.tree.tnFocused.span).removeClass(b.classNames.focused)),this.tree.tnFocused=this,b.onFocus&&b.onFocus.call(this.tree,this),$(this.tree.tnFocused.span).addClass(b.classNames.focused),b.persist&&$.cookie(b.cookieId+"-focus",this.data.key,b.cookie)},visit:function(a,b){var c=!0;if(b===!0){c=a(this);if(c===!1||c=="skip")return c}if(this.childList)for(var d=0,e=this.childList.length;d<e;d++){c=this.childList[d].visit(a,!0);if(c===!1)break}return c},visitParents:function(a,b){if(b&&a(this)===!1)return!1;var c=this.parent;while(c){if(a(c)===!1)return!1;c=c.parent}return!0},remove:function(){if(this===this.tree.root)throw"Cannot remove system root";return this.parent.removeChild(this)},removeChild:function(a){var b=this.childList;if(b.length==1){if(a!==b[0])throw"removeChild: invalid child";return this.removeChildren()}a===this.tree.activeNode&&a.deactivate(),this.tree.options.persist&&(a.bSelected&&this.tree.persistence.clearSelect(a.data.key),a.bExpanded&&this.tree.persistence.clearExpand(a.data.key)),a.removeChildren(!0),this.ul.removeChild(a.li);for(var c=0,d=b.length;c<d;c++)if(b[c]===a){this.childList.splice(c,1);break}},removeChildren:function(a,b){this.tree.logDebug("%s.removeChildren(%o)",this,a);var c=this.tree,d=this.childList;if(d){for(var e=0,f=d.length;e<f;e++){var g=d[e];g===c.activeNode&&!b&&g.deactivate(),this.tree.options.persist&&!b&&(g.bSelected&&this.tree.persistence.clearSelect(g.data.key),g.bExpanded&&this.tree.persistence.clearExpand(g.data.key)),g.removeChildren(!0,b),this.ul&&$("li",$(this.ul)).remove()}this.childList=null}a||(this._isLoading=!1,this.render())},setTitle:function(a){this.fromDict({title:a})},reload:function(a){throw"Use reloadChildren() instead"},reloadChildren:function(a){if(this.parent===null)throw"Use tree.reload() instead";if(!this.data.isLazy)throw"node.reloadChildren() requires lazy nodes.";if(a){var b=this,c="nodeLoaded.dynatree."+this.tree.$tree.attr("id")+"."+this.data.key;this.tree.$tree.bind(c,function(d,e,f){b.tree.$tree.unbind(c),b.tree.logDebug("loaded %o, %o, %o",d,e,f);if(e!==b)throw"got invalid load event";a.call(b.tree,e,f)})}this.removeChildren(),this._loadContent()},_loadKeyPath:function(a,b){var c=this.tree;c.logDebug("%s._loadKeyPath(%s)",this,a);if(a==="")throw"Key path must not be empty";var d=a.split(c.options.keyPathSeparator);if(d[0]==="")throw"Key path must be relative (don't start with '/')";var e=d.shift();if(this.childList)for(var f=0,g=this.childList.length;f<g;f++){var h=this.childList[f];if(h.data.key===e){if(d.length===0)b.call(c,h,"ok");else if(!h.data.isLazy||h.childList!==null&&h.childList!==undefined)b.call(c,h,"loaded"),h._loadKeyPath(d.join(c.options.keyPathSeparator),b);else{c.logDebug("%s._loadKeyPath(%s) -> reloading %s...",this,a,h);var i=this;h.reloadChildren(function(e,f){f?(c.logDebug("%s._loadKeyPath(%s) -> reloaded %s.",e,a,e),b.call(c,h,"loaded"),e._loadKeyPath(d.join(c.options.keyPathSeparator),b)):(c.logWarning("%s._loadKeyPath(%s) -> reloadChildren() failed.",i,a),b.call(c,h,"error"))})}return}}b.call(c,undefined,"notfound",e,d.length===0),c.logWarning("Node not found: "+e);return},resetLazy:function(){if(this.parent===null)throw"Use tree.reload() instead";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&&$(this.childList[this.childList.length-1].span).removeClass(d.classNames.lastsib);if(b){var f=$.inArray(b,this.childList);if(f<0)throw"<beforeNode> must be a child of <this>";this.childList.splice(f,0,a)}else this.childList.push(a);var g=c.isInitializing();d.persist&&e.cookiesFound&&g?(e.activeKey===a.data.key&&(c.activeNode=a),e.focusedKey===a.data.key&&(c.focusNode=a),a.bExpanded=$.inArray(a.data.key,e.expandedKeyList)>=0,a.bSelected=$.inArray(a.data.key,e.selectedKeyList)>=0):(a.data.activate&&(c.activeNode=a,d.persist&&(e.activeKey=a.data.key)),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)),d.minExpandLevel>=a.getLevel()&&(this.bExpanded=!0);if(a.bSelected&&d.selectMode==3){var h=this;while(h)h.hasSubSel||h._setSubSel(!0),h=h.parent}return c.bEnableUpdate&&this.render(),a},addChild:function(a,b){if(typeof a=="string")throw"Invalid data type for "+a;if(!a||a.length===0)return;if(a instanceof DynaTreeNode)return this._addChildNode(a,b);a.length||(a=[a]);var c=this.tree.enableUpdate(!1),d=null;for(var e=0,f=a.length;e<f;e++){var g=a[e],h=this._addChildNode(new DynaTreeNode(this,this.tree,g),b);d||(d=h),g.children&&h.addChild(g.children,null)}return this.tree.enableUpdate(c),d},append:function(a){return this.tree.logWarning("node.append() is deprecated (use node.addChild() instead)."),this.addChild(a,null)},appendAjax:function(a){var b=this;this.removeChildren(!1,!0),this.setLazyNodeStatus(DTNodeStatus_Loading);if(a.debugLazyDelay){var c=a.debugLazyDelay;a.debugLazyDelay=0,this.tree.logInfo("appendAjax: waiting for debugLazyDelay "+c),setTimeout(function(){b.appendAjax(a)},c);return}var d=a.success,e=a.error,f="nodeLoaded.dynatree."+this.tree.$tree.attr("id")+"."+this.data.key,g=$.extend({},this.tree.options.ajaxDefaults,a,{success:function(a,c,e){var h=b.tree.phase;b.tree.phase="init",g.postProcess?a=g.postProcess.call(this,a,this.dataType):a&&a.hasOwnProperty("d")&&(a=typeof a.d=="string"?$.parseJSON(a.d):a.d),(!$.isArray(a)||a.length!==0)&&b.addChild(a,null),b.tree.phase="postInit",d&&d.call(g,b,a,c),b.tree.logDebug("trigger "+f),b.tree.$tree.trigger(f,[b,!0]),b.tree.phase=h,b.setLazyNodeStatus(DTNodeStatus_Ok),$.isArray(a)&&a.length===0&&(b.childList=[],b.render())},error:function(a,c,d){b.tree.logWarning("appendAjax failed:",c,":\n",a,"\n",d),e&&e.call(g,b,a,c,d),b.tree.$tree.trigger(f,[b,!1]),b.setLazyNodeStatus(DTNodeStatus_Error,{info:c,tooltip:""+d})}});$.ajax(g)},move:function(a,b){var c;if(this===a)return;if(!this.parent)throw"Cannot move system root";if(b===undefined||b=="over")b="child";var d=this.parent,e=b==="child"?a:a.parent;if(e.isDescendantOf(this))throw"Cannot move a node to it's own descendant";if(this.parent.childList.length==1)this.parent.childList=this.parent.data.isLazy?[]:null,this.parent.bExpanded=!1;else{c=$.inArray(this,this.parent.childList);if(c<0)throw"Internal error";this.parent.childList.splice(c,1)}this.parent.ul&&this.parent.ul.removeChild(this.li),this.parent=e;if(e.hasChildren())switch(b){case"child":e.childList.push(this);break;case"before":c=$.inArray(a,e.childList);if(c<0)throw"Internal error";e.childList.splice(c,0,this);break;case"after":c=$.inArray(a,e.childList);if(c<0)throw"Internal error";e.childList.splice(c+1,0,this);break;default:throw"Invalid mode "+b}else e.childList=[this];e.ul||(e.ul=document.createElement("ul"),e.ul.style.display="none",e.li.appendChild(e.ul)),this.li&&e.ul.appendChild(this.li);if(this.tree!==a.tree)throw this.visit(function(b){b.tree=a.tree},null,!0),"Not yet implemented.";d.isDescendantOf(e)||d.render(),e.isDescendantOf(d)||e.render()},lastentry:undefined};var DynaTreeStatus=Class.create();DynaTreeStatus._getTreePersistData=function(a,b){var c=new DynaTreeStatus(a,b);return c.read(),c.toDict()},getDynaTreePersistData=DynaTreeStatus._getTreePersistData,DynaTreeStatus.prototype={initialize:function(a,b){a===undefined&&(a=$.ui.dynatree.prototype.options.cookieId),b=$.extend({},$.ui.dynatree.prototype.options.cookie,b),this.cookieId=a,this.cookieOpts=b,this.cookiesFound=undefined,this.activeKey=null,this.focusedKey=null,this.expandedKeyList=null,this.selectedKeyList=null},_log:function(a){Array.prototype.unshift.apply(arguments,["debug"]),_log.apply(this,arguments)},read:function(){this.cookiesFound=!1;var a=$.cookie(this.cookieId+"-active");this.activeKey=a===null?"":a,a!==null&&(this.cookiesFound=!0),a=$.cookie(this.cookieId+"-focus"),this.focusedKey=a===null?"":a,a!==null&&(this.cookiesFound=!0),a=$.cookie(this.cookieId+"-expand"),this.expandedKeyList=a===null?[]:a.split(","),a!==null&&(this.cookiesFound=!0),a=$.cookie(this.cookieId+"-select"),this.selectedKeyList=a===null?[]:a.split(","),a!==null&&(this.cookiesFound=!0)},write:function(){$.cookie(this.cookieId+"-active",this.activeKey===null?"":this.activeKey,this.cookieOpts),$.cookie(this.cookieId+"-focus",this.focusedKey===null?"":this.focusedKey,this.cookieOpts),$.cookie(this.cookieId+"-expand",this.expandedKeyList===null?"":this.expandedKeyList.join(","),this.cookieOpts),$.cookie(this.cookieId+"-select",this.selectedKeyList===null?"":this.selectedKeyList.join(","),this.cookieOpts)},addExpand:function(a){$.inArray(a,this.expandedKeyList)<0&&(this.expandedKeyList.push(a),$.cookie(this.cookieId+"-expand",this.expandedKeyList.join(","),this.cookieOpts))},clearExpand:function(a){var b=$.inArray(a,this.expandedKeyList);b>=0&&(this.expandedKeyList.splice(b,1),$.cookie(this.cookieId+"-expand",this.expandedKeyList.join(","),this.cookieOpts))},addSelect:function(a){$.inArray(a,this.selectedKeyList)<0&&(this.selectedKeyList.push(a),$.cookie(this.cookieId+"-select",this.selectedKeyList.join(","),this.cookieOpts))},clearSelect:function(a){var b=$.inArray(a,this.selectedKeyList);b>=0&&(this.selectedKeyList.splice(b,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};var DynaTree=Class.create();DynaTree.version="$Version:$",DynaTree.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),_initDragAndDrop(this)},_load:function(a){var b=this.$widget,c=this.options,d=this;this.bEnableUpdate=!0,this._nodeCount=1,this.activeNode=null,this.focusNode=null,c.rootVisible!==undefined&&this.logWarning("Option 'rootVisible' is no longer supported."),c.minExpandLevel<1&&(this.logWarning("Option 'minExpandLevel' must be >= 1."),c.minExpandLevel=1),c.classNames!==$.ui.dynatree.prototype.options.classNames&&(c.classNames=$.extend({},$.ui.dynatree.prototype.options.classNames,c.classNames)),c.ajaxDefaults!==$.ui.dynatree.prototype.options.ajaxDefaults&&(c.ajaxDefaults=$.extend({},$.ui.dynatree.prototype.options.ajaxDefaults,c.ajaxDefaults)),c.dnd!==$.ui.dynatree.prototype.options.dnd&&(c.dnd=$.extend({},$.ui.dynatree.prototype.options.dnd,c.dnd)),c.imagePath||$("script").each(function(){var a=/.*dynatree[^\/]*\.js$/i;if(this.src.search(a)>=0)return this.src.indexOf("/")>=0?c.imagePath=this.src.slice(0,this.src.lastIndexOf("/"))+"/skin/":c.imagePath="skin/",d.logDebug("Guessing imagePath from '%s': '%s'",this.src,c.imagePath),!1}),this.persistence=new DynaTreeStatus(c.cookieId,c.cookie),c.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 class='"+c.classNames.empty+"'></span>",tagVline:"<span class='"+c.classNames.vline+"'></span>",tagExpander:"<span class='"+c.classNames.expander+"'></span>",tagConnector:"<span class='"+c.classNames.connector+"'></span>",tagNodeIcon:"<span class='"+c.classNames.nodeIcon+"'></span>",tagCheckbox:"<span class='"+c.classNames.checkbox+"'></span>",lastentry:undefined},(c.children||c.initAjax&&c.initAjax.url||c.initId)&&$(this.divTree).empty();var e=this.$tree.find(">ul:first").hide();this.tnRoot=new DynaTreeNode(null,this,{}),this.tnRoot.bExpanded=!0,this.tnRoot.render(),this.divTree.appendChild(this.tnRoot.ul);var f=this.tnRoot,g=c.persist&&this.persistence.isReloading(),h=!1,i=this.enableUpdate(!1);this.logDebug("Dynatree._load(): read tree structure..."),c.children?f.addChild(c.children):c.initAjax&&c.initAjax.url?(h=!0,f.data.isLazy=!0,this._reloadAjax(a)):c.initId?this._createFromTag(f,$("#"+c.initId)):(this._createFromTag(f,e),e.remove()),this._checkConsistency(),!h&&c.selectMode==3&&f._updatePartSelectionState(),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",c.persist&&this.persistence.write(),this.focusNode&&this.focusNode.isVisible()&&(this.logDebug("Focus on init: %o",this.focusNode),this.focusNode.focus()),h||(c.onPostInit&&c.onPostInit.call(this,g,!1),a&&a.call(this,"ok")),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=$.extend({},b.initAjax);d.addActiveKey&&(d.data.activeKey=c.activeKey),d.addFocusedKey&&(d.data.focusedKey=c.focusedKey),d.addExpandedKeyList&&(d.data.expandedKeyList=c.expandedKeyList.join(",")),d.addSelectedKeyList&&(d.data.selectedKeyList=c.selectedKeyList.join(",")),d.success&&this.logWarning("initAjax: success callback is ignored; use onPostInit instead."),d.error&&this.logWarning("initAjax: error callback is ignored; use onPostInit instead.");var e=c.isReloading();d.success=function(c,d,f){b.selectMode==3&&c.tree.tnRoot._updatePartSelectionState(),b.onPostInit&&b.onPostInit.call(c.tree,e,!1),a&&a.call(c.tree,"ok")},d.error=function(c,d,f,g){b.onPostInit&&b.onPostInit.call(c.tree,e,!0,d,f,g),a&&a.call(c.tree,"error",d,f,g)},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){var b=this.getSelectedNodes(a),c=this.$tree.attr("name")||this.$tree.attr("id"),d=[];for(var e=0,f=b.length;e<f;e++)d.push({name:c,value:b[e].data.key});return d},getPersistData:function(){return this.persistence.toDict()},logDebug:function(a){this.options.debugLevel>=2&&(Array.prototype.unshift.apply(arguments,["debug"]),_log.apply(this,arguments))},logInfo:function(a){this.options.debugLevel>=1&&(Array.prototype.unshift.apply(arguments,["info"]),_log.apply(this,arguments))},logWarning:function(a){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;return this.visit(function(b){if(b.data.key==a)return c=b,!1},!0),c},getActiveNode:function(){return this.activeNode},reactivate:function(a){var b=this.activeNode;b&&(this.activeNode=null,b.activate(),a&&b.focus())},getSelectedNodes:function(a){var b=[];return this.tnRoot.visit(function(c){if(c.bSelected){b.push(c);if(a===!0)return"skip"}}),b},activateKey:function(a){var b=a===null?null:this.getNodeByKey(a);return b?(b.focus(),b.activate(),b):(this.activeNode&&this.activeNode.deactivate(),this.activeNode=null,null)},loadKeyPath:function(a,b){var c=a.split(this.options.keyPathSeparator);return c[0]===""&&c.shift(),c[0]==this.tnRoot.data.key&&(this.logDebug("Removed leading root key."),c.shift()),a=c.join(this.options.keyPathSeparator),this.tnRoot._loadKeyPath(a,b)},selectKey:function(a,b){var c=this.getNodeByKey(a);return c?(c.select(b),c):null},enableUpdate:function(a){return this.bEnableUpdate==a?a:(this.bEnableUpdate=a,a&&this.redraw(),!a)},count:function(){return this.tnRoot.countChildren()},visit:function(a,b){return this.tnRoot.visit(a,b)},_createFromTag:function(parentTreeNode,$ulParent){var self=this;$ulParent.find(">li").each(function(){var $li=$(this),$liSpan=$li.find(">span:first"),$liA=$li.find(">a:first"),title,href=null,target=null,tooltip;if($liSpan.length)title=$liSpan.html();else if($liA.length)title=$liA.html(),href=$liA.attr("href"),target=$liA.attr("target"),tooltip=$liA.attr("title");else{title=$li.html();var iPos=title.search(/<ul/i);iPos>=0?title=$.trim(title.substring(0,iPos)):title=$.trim(title)}var 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"));if($li.attr("data")){var dataAttr=$.trim($li.attr("data"));if(dataAttr){dataAttr.charAt(0)!="{"&&(dataAttr="{"+dataAttr+"}");try{$.extend(data,eval("("+dataAttr+")"))}catch(e){throw"Error parsing node data: "+e+"\ndata:\n'"+dataAttr+"'"}}}var childNode=parentTreeNode.addChild(data),$ul=$li.find(">ul:first");$ul.length&&self._createFromTag(childNode,$ul)})},_checkConsistency:function(){},_setDndStatus:function(a,b,c,d,e){var f=a?$(a.span):null,g=$(b.span);this.$dndMarker||(this.$dndMarker=$("<div id='dynatree-drop-marker'></div>").hide().css({"z-index":1e3}).prependTo($(this.divTree).parent()));if(d==="after"||d==="before"||d==="over"){var h="0 0";switch(d){case"before":this.$dndMarker.removeClass("dynatree-drop-after dynatree-drop-over"),this.$dndMarker.addClass("dynatree-drop-before"),h="0 -8";break;case"after":this.$dndMarker.removeClass("dynatree-drop-before dynatree-drop-over"),this.$dndMarker.addClass("dynatree-drop-after"),h="0 8";break;default:this.$dndMarker.removeClass("dynatree-drop-after dynatree-drop-before"),this.$dndMarker.addClass("dynatree-drop-over"),g.addClass("dynatree-drop-target"),h="8 0"}this.$dndMarker.show().position({my:"left top",at:"left top",of:g,offset:h})}else g.removeClass("dynatree-drop-target"),this.$dndMarker.hide();d==="after"?g.addClass("dynatree-drop-after"):g.removeClass("dynatree-drop-after"),d==="before"?g.addClass("dynatree-drop-before"):g.removeClass("dynatree-drop-before"),e===!0?(f&&f.addClass("dynatree-drop-accept"),g.addClass("dynatree-drop-accept"),c.addClass("dynatree-drop-accept")):(f&&f.removeClass("dynatree-drop-accept"),g.removeClass("dynatree-drop-accept"),c.removeClass("dynatree-drop-accept")),e===!1?(f&&f.addClass("dynatree-drop-reject"),g.addClass("dynatree-drop-reject"),c.addClass("dynatree-drop-reject")):(f&&f.removeClass("dynatree-drop-reject"),g.removeClass("dynatree-drop-reject"),c.removeClass("dynatree-drop-reject"))},_onDragEvent:function(a,b,c,d,e,f){var g=this.options,h=this.options.dnd,i=null,j=$(b.span),k,l;switch(a){case"helper":var m=$("<div class='dynatree-drag-helper'><span class='dynatree-drag-helper-img' /></div>").append($(d.target).closest("a").clone());$("ul.dynatree-container",b.tree.divTree).append(m),m.data("dtSourceNode",b),i=m;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?i={over:i===!0||i==="over"||$.inArray("over",i)>=0,before:i===!0||i==="before"||$.inArray("before",i)>=0,after:i===!0||i==="after"||$.inArray("after",i)>=0}:i=!1,e.helper.data("enterResponse",i);break;case"over":l=e.helper.data("enterResponse"),k=null;if(l!==!1)if(typeof l=="string")k=l;else{var n=j.offset(),o={x:d.pageX-n.left,y:d.pageY-n.top},p={x:o.x/j.width(),y:o.y/j.height()};l.after&&p.y>.75?k="after":!l.over&&l.after&&p.y>.5?k="after":l.before&&p.y<=.25?k="before":!l.over&&l.before&&p.y<=.5?k="before":l.over&&(k="over"),h.preventVoidMoves&&(b===c?k=null:k==="before"&&c&&b===c.getNextSibling()?k=null:k==="after"&&c&&b===c.getPrevSibling()?k=null:k==="over"&&c&&c.parent===b&&c.isLastSibling()&&(k=null)),e.helper.data("hitMode",k)}k==="over"&&h.autoExpandMS&&b.hasChildren()!==!1&&!b.bExpanded&&b.scheduleAction("expand",h.autoExpandMS);if(k&&h.onDragOver){i=h.onDragOver(b,c,k);if(i==="over"||i==="before"||i==="after")k=i}this._setDndStatus(c,b,e.helper,k,i!==!1&&k!==null);break;case"drop":var q=e.helper.hasClass("dynatree-drop-reject");k=e.helper.data("hitMode"),k&&h.onDrop&&!q&&h.onDrop(b,c,k,e,f);break;case"leave":b.scheduleAction("cancel"),e.helper.data("enterResponse",null),e.helper.data("hitMode",null),this._setDndStatus(c,b,e.helper,"out",undefined),h.onDragLeave&&h.onDragLeave(b,c);break;case"stop":j.removeClass("dynatree-drag-source"),h.onDragStop&&h.onDragStop(b);break;default:throw"Unsupported drag event: "+a}return i},cancelDrag:function(){var a=$.ui.ddmanager.current;a&&a.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 a=this.options;a.debugLevel>=1&&logMsg("Dynatree._create(): version='%s', debugLevel=%o.",$.ui.dynatree.version,this.options.debugLevel),this.options.event+=".dynatree";var b=this.element.get(0);this.tree=new DynaTree(this),this.tree._load(),this.tree.logDebug("Dynatree._init(): done.")},bind:function(){function b(a){a=$.event.fix(a||window.event);var b=$.ui.dynatree.getNode(a.target);return b?b._onFocus(a):!1}this.unbind();var a="click.dynatree dblclick.dynatree";this.options.keyboard&&(a+=" keypress.dynatree keydown.dynatree"),this.element.bind(a,function(a){var b=$.ui.dynatree.getNode(a.target);if(!b)return!0;var c=b.tree,d=c.options;c.logDebug("event(%s): dtnode: %s",a.type,b);var e=c.phase;c.phase="userEvent";try{switch(a.type){case"click":return d.onClick&&d.onClick.call(c,b,a)===!1?!1:b._onClick(a);case"dblclick":return d.onDblClick&&d.onDblClick.call(c,b,a)===!1?!1:b._onDblClick(a);case"keydown":return d.onKeydown&&d.onKeydown.call(c,b,a)===!1?!1:b._onKeydown(a);case"keypress":return d.onKeypress&&d.onKeypress.call(c,b,a)===!1?!1:b._onKeypress(a)}}catch(f){var g=null;c.logWarning("bind(%o): dtnode: %o, error: %o",a,b,f)}finally{c.phase=e}});var c=this.tree.divTree;c.addEventListener?(c.addEventListener("focus",b,!0),c.addEventListener("blur",b,!0)):c.onfocusin=c.onfocusout=b},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:$",$.ui.dynatree.getNode=function(a){if(a instanceof DynaTreeNode)return a;a.selector!==undefined&&(a=a[0]);while(a){if(a.dtnode)return a.dtnode;a=a.parentNode}return null},$.ui.dynatree.getPersistData=DynaTreeStatus._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&#8230;",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: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};var didRegisterDnd=!1,_registerDnd=function(){if(didRegisterDnd)return;$.ui.plugin.add("draggable","connectToDynatree",{start:function(a,b){var c=$(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=$(this).data("draggable"),d=b.helper.data("dtSourceNode")||null,e=b.helper.data("dtTargetNode")||null,f=$.ui.dynatree.getNode(a.target);if(a.target&&!f){var g=$(a.target).closest("div.dynatree-drag-helper,#dynatree-drop-marker").length>0;if(g)return}b.helper.data("dtTargetNode",f),e&&e!==f&&e.tree._onDragEvent("leave",e,d,a,b,c),f&&(!f.tree.options.dnd.onDrop||(f===e?f.tree._onDragEvent("over",f,d,a,b,c):f.tree._onDragEvent("enter",f,d,a,b,c)))},stop:function(a,b){var c=$(this).data("draggable"),d=b.helper.data("dtSourceNode")||null,e=b.helper.data("dtTargetNode")||null,f=c._mouseDownEvent,g=a.type,h=g=="mouseup"&&a.which==1;h||logMsg("Drag was cancelled"),e&&(h&&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)}}),didRegisterDnd=!0}})(jQuery);
New to GrepCode? Check out our FAQ X