var _canLog=!0;function _log(e,l){if(_canLog){var j=Array.prototype.slice.apply(arguments,[1]),h=new Date,h=h.getHours()+":"+h.getMinutes()+":"+h.getSeconds()+"."+h.getMilliseconds();j[0]=h+" - "+j[0];try{switch(e){case "info":window.console.info.apply(window.console,j);break;case "warn":window.console.warn.apply(window.console,j);break;default:window.console.log.apply(window.console,j)}}catch(k){window.console||(_canLog=!1)}}} function logMsg(e){Array.prototype.unshift.apply(arguments,["debug"]);_log.apply(this,arguments)}var getDynaTreePersistData=void 0,DTNodeStatus_Error=-1,DTNodeStatus_Loading=1,DTNodeStatus_Ok=0; (function(e){var l={create:function(){return function(){this.initialize.apply(this,arguments)}}},j=l.create();j.prototype={initialize:function(a,b,c){this.parent=a;this.tree=b;"string"==typeof c&&(c={title:c});void 0==c.key&&(c.key="_"+b._nodeCount++);this.data=e.extend({},e.ui.dynatree.nodedatadefaults,c);this.childList=this.span=this.div=null;this.hasSubSel=this.isLoading=!1},toString:function(){return"dtnode<"+this.data.key+">: '"+this.data.title+"'"},toDict:function(a,b){var c=e.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;d":!1!=this.data.icon&&(f+=b.tagNodeIcon);return f+=""+this.data.title+""},_fixOrder:function(){var a=this.childList;if(a)for(var b= this.div.firstChild.nextSibling,c=0;cc.className.indexOf(b.folder)&&0>c.className.indexOf(b.document))return null;var d=a.pageX-c.offsetLeft;a=a.pageY-c.offsetTop;for(var f=0;f=e&&d<=e+j&&a>=h&&a<=h+k){if(g.className==b.title)return"title";if(g.className==b.expander)return"expander";if(g.className== b.checkbox)return"checkbox";if(g.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":0<=b.indexOf(c.folder)||0<=b.indexOf(c.document)?this._getTypeForOuterNodeEvent(a):null},isVisible:function(){for(var a=this._parentList(!0,!1),b=0;ba").focus()}catch(a){}},_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&&!1==c.onQueryActivate.call(this.span,a,this))))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&&e.cookie(c.cookieId+"-active",this.data.key,c.cookie);this.tree.persistence.activeKey=this.data.key;e(this.span).addClass(c.classNames.active);b&&c.onActivate&&c.onActivate.call(this.span,this)}else this.tree.activeNode===this&&(c=this.tree.options,c.onQueryActivate&&!1==c.onQueryActivate.call(this.span,!1,this)||(e(this.span).removeClass(c.classNames.active),c.persist&&e.cookie(c.cookieId+"-active","",c.cookie),this.tree.persistence.activeKey= null,this.tree.activeNode=null,b&&c.onDeactivate&&c.onDeactivate.call(this.span,this)))},activate:function(){this._activate(!0,!0)},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}null==this.parent&&0g)throw" must be a child of ";this.childList.splice(g,0,a)}else this.childList.push(a);g=c.isInitializing();d.persist&&f.cookiesFound&&g?(f.activeKey==a.data.key&&(c.activeNode=a),f.focusedKey==a.data.key&&(c.focusNode=a),a.bExpanded=0<=e.inArray(a.data.key,f.expandedKeyList),a.bSelected=0<=e.inArray(a.data.key,f.selectedKeyList)):(a.data.activate&&(c.activeNode=a,d.persist&&(f.activeKey=a.data.key)),a.data.focus&&(c.focusNode=a,d.persist&& (f.focusedKey=a.data.key)),a.bExpanded=!0==a.data.expand,a.bExpanded&&d.persist&&f.addExpand(a.data.key),a.bSelected=!0==a.data.select,a.bSelected&&d.persist&&f.addSelect(a.data.key));d.minExpandLevel>=a.getLevel()&&(this.bExpanded=!0);if(a.bSelected&&3==d.selectMode)for(d=this;d;)d.hasSubSel||d._setSubSel(!0),d=d.parent;c.bEnableUpdate&&this.render(!0,!0);return a},addChild:function(a,b){if(a&&0!=a.length){if(a instanceof j)return this._addChildNode(a,b);a.length||(a=[a]);for(var c=this.tree.enableUpdate(!1), d=null,f=0;fe.inArray(a,this.expandedKeyList)&&(this.expandedKeyList.push(a),e.cookie(this.cookieId+"-expand",this.expandedKeyList.join(","),this.cookieOpts))},clearExpand:function(a){this._log("clearExpand(%o)",a);a=e.inArray(a,this.expandedKeyList);0<=a&&(this.expandedKeyList.splice(a,1),e.cookie(this.cookieId+"-expand",this.expandedKeyList.join(","), this.cookieOpts))},addSelect:function(a){this._log("addSelect(%o)",a);0>e.inArray(a,this.selectedKeyList)&&(this.selectedKeyList.push(a),e.cookie(this.cookieId+"-select",this.selectedKeyList.join(","),this.cookieOpts))},clearSelect:function(a){this._log("clearSelect(%o)",a);a=e.inArray(a,this.selectedKeyList);0<=a&&(this.selectedKeyList.splice(a,1),e.cookie(this.cookieId+"-select",this.selectedKeyList.join(","),this.cookieOpts))},isReloading:function(){return!0==this.cookiesFound},toDict:function(){return{cookiesFound:this.cookiesFound, activeKey:this.activeKey,focusedKey:this.activeKey,expandedKeyList:this.expandedKeyList,selectedKeyList:this.selectedKeyList}},lastentry:void 0};var k=l.create();k.version="$Version: 0.5.4$";k.prototype={initialize:function(a){this.phase="init";this.$widget=a;this.options=a.options;this.$tree=a.element;this.divTree=this.$tree.get(0)},_load:function(){var a=this.options;this.bEnableUpdate=!0;this._nodeCount=1;this.focusNode=this.activeNode=null;a.classNames!==e.ui.dynatree.defaults.classNames&&(a.classNames= e.extend({},e.ui.dynatree.defaults.classNames,a.classNames));a.imagePath||e("script").each(function(){if(0<=this.src.search(_rexDtLibName))return a.imagePath=0<=this.src.indexOf("/")?this.src.slice(0,this.src.lastIndexOf("/"))+"/skin/":"skin/",!1});this.persistence=new h(a.cookieId,a.cookie);a.persist&&(e.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};a.children||a.initAjax&&a.initAjax.url||a.initId?e(this.divTree).empty():this.divRoot&&e(this.divRoot).remove();this.tnRoot=new j(null,this,{title:a.title, key:"root"});this.tnRoot.data.isFolder=!0;this.tnRoot.render(!1,!1);this.divRoot=this.tnRoot.div;this.divRoot.className=a.classNames.container;this.divTree.appendChild(this.divRoot);var b=this.tnRoot,c=a.persist&&this.persistence.isReloading(),d=!1,f=this.enableUpdate(!1);this.logDebug("Dynatree._load(): read tree structure...");if(a.children)b.addChild(a.children);else if(a.initAjax&&a.initAjax.url)d=!0,b.data.isLazy=!0,this._reloadAjax();else if(a.initId)this._createFromTag(b,e("#"+a.initId));else{var g= this.$tree.find(">ul").hide();this._createFromTag(b,g);g.remove()}this._checkConsistency();this.logDebug("Dynatree._load(): render nodes...");this.enableUpdate(f);this.logDebug("Dynatree._load(): bind events...");this.$widget.bind();this.logDebug("Dynatree._load(): postInit...");this.phase="postInit";a.persist&&this.persistence.write();this.focusNode&&this.focusNode.isVisible()&&(this.logDebug("Focus on init: %o",this.focusNode),this.focusNode.focus());!d&&a.onPostInit&&a.onPostInit.call(this,c,!1); this.phase="idle"},_reloadAjax:function(){var a=this.options;if(!a.initAjax||!a.initAjax.url)throw"tree.reload() requires 'initAjax' mode.";var b=this.persistence,c=e.extend({},a.initAjax);c.addActiveKey&&(c.data.activeKey=b.activeKey);c.addFocusedKey&&(c.data.focusedKey=b.focusedKey);c.addExpandedKeyList&&(c.data.expandedKeyList=b.expandedKeyList.join(","));c.addSelectedKeyList&&(c.data.selectedKeyList=b.selectedKeyList.join(","));if(a.onPostInit){c.success&&this.logWarning("initAjax: success callback is ignored when onPostInit was specified."); c.error&&this.logWarning("initAjax: error callback is ignored when onPostInit was specified.");var d=b.isReloading();c.success=function(b){a.onPostInit.call(b.tree,d,!1)};c.error=function(b){a.onPostInit.call(b.tree,d,!0)}}this.logDebug("Dynatree._init(): send Ajax request...");this.tnRoot.appendAjax(c)},toString:function(){return"DynaTree '"+this.options.title+"'"},toDict:function(){return this.tnRoot.toDict(!0)},getPersistData:function(){return this.persistence.toDict()},logDebug:function(a){2<= this.options.debugLevel&&(Array.prototype.unshift.apply(arguments,["debug"]),_log.apply(this,arguments))},logInfo:function(a){1<=this.options.debugLevel&&(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"init"==this.phase||"postInit"==this.phase},isReloading:function(){return("init"==this.phase||"postInit"==this.phase)&&this.options.persist&& this.persistence.cookiesFound},isUserEvent:function(){return"userEvent"==this.phase},redraw:function(){this.logDebug("dynatree.redraw()...");this.tnRoot.render(!0,!0);this.logDebug("dynatree.redraw() done.")},reloadAjax:function(){this.logWarning("tree.reloadAjax() is deprecated since v0.5.2 (use reload() instead).")},reload:function(){this._load()},getRoot:function(){return this.tnRoot},getNodeByKey:function(a){return(a=document.getElementById(this.options.idPrefix+a))&&a.dtnode?a.dtnode:null},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=[];this.tnRoot.visit(function(c){if(c.bSelected&&(b.push(c),!0==a))return!1});return b},activateKey:function(a){a=null===a?null:this.getNodeByKey(a);if(!a)return this.activeNode&&this.activeNode.deactivate(),this.activeNode=null;a.focus();a.activate();return a},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},visit:function(a,b,c){return this.tnRoot.visit(a,b,c)},_createFromTag:function(a,b){var c=this;b.find(">li").each(function(){var b=e(this),f=b.find(">span:first");if(f.length)f=f.html();else var f=b.html(),g=f.search(/
    ul:first");b.length&&c._createFromTag(childNode,b)})},_checkConsistency:function(){},lastentry:void 0};e.widget("ui.dynatree",{init:function(){_log("warn","ui.dynatree.init() was called; you should upgrade to ui.core.js v1.6 or higher."); return this._init()},_init:function(){if(1.8>parseFloat(e.ui.version))return _log("info","ui.dynatree._init() was called; consider upgrading to jquery.ui.core.js v1.8 or higher."),this._create();_log("debug","ui.dynatree._init() was called; no current default functionality.")},_create:function(){1.8<=parseFloat(e.ui.version)&&(this.options=e.extend(!0,{},e[this.namespace][this.widgetName].defaults,this.options));logMsg("Dynatree._create(): version='%s', debugLevel=%o.",k.version,this.options.debugLevel); this.options.event+=".dynatree";this.element.get(0);this.tree=new k(this);this.tree._load();this.tree.logDebug("Dynatree._create(): done.")},bind:function(){function a(a){for(var b=5;a&&b--;){if(a.dtnode)return a.dtnode;a=a.parentNode}return null}function b(b){b=b=e.event.fix(b||window.event);var c=a(b.target);return c?c.onFocus(b):!1}var c=this.element,d=this.options;this.unbind();var f="click.dynatree dblclick.dynatree";d.keyboard&&(f+=" keypress.dynatree keydown.dynatree");c.bind(f,function(b){var c= a(b.target);if(!c)return!0;var e=c.tree.phase;c.tree.phase="userEvent";try{switch(c.tree.logDebug("bind(%o): dtnode: %o",b,c),b.type){case "click":return d.onClick&&!1===d.onClick(c,b)?!1:c.onClick(b);case "dblclick":return d.onDblClick&&!1===d.onDblClick(c,b)?!1:c.onDblClick(b);case "keydown":return d.onKeydown&&!1===d.onKeydown(c,b)?!1:c.onKeydown(b);case "keypress":return d.onKeypress&&!1===d.onKeypress(c,b)?!1:c.onKeypress(b)}}catch(f){}finally{c.tree.phase=e}});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();e.widget.prototype.enable.apply(this,arguments)},disable:function(){this.unbind();e.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});e.ui.dynatree.getter="getTree getRoot getActiveNode getSelectedNodes";e.ui.dynatree.defaults={title:"Dynatree root",rootVisible:!1,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,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,ajaxDefaults:{cache:!1,dataType:"json"},strings:{loading:"Loading…",loadError:"Load error!"},idPrefix:"ui-dynatree-id-",cookieId:"dynatree",cookie:{expires:null},classNames:{container:"ui-dynatree-container",folder:"ui-dynatree-folder",document:"ui-dynatree-document",empty:"ui-dynatree-empty",vline:"ui-dynatree-vline",expander:"ui-dynatree-expander",connector:"ui-dynatree-connector",checkbox:"ui-dynatree-checkbox", nodeIcon:"ui-dynatree-icon",title:"ui-dynatree-title",nodeError:"ui-dynatree-statusnode-error",nodeWait:"ui-dynatree-statusnode-wait",hidden:"ui-dynatree-hidden",combinedExpanderPrefix:"ui-dynatree-exp-",combinedIconPrefix:"ui-dynatree-ico-",hasChildren:"ui-dynatree-has-children",active:"ui-dynatree-active",selected:"ui-dynatree-selected",expanded:"ui-dynatree-expanded",lazy:"ui-dynatree-lazy",focused:"ui-dynatree-focused",partsel:"ui-dynatree-partsel",lastsib:"ui-dynatree-lastsib"},debugLevel:1, lastentry:void 0};e.ui.dynatree.nodedatadefaults={title:null,key:null,isFolder:!1,isLazy:!1,tooltip:null,icon:null,addClass:null,activate:!1,focus:!1,expand:!1,select:!1,hideCheckbox:!1,unselectable:!1,children:null,lastentry:void 0}})(jQuery);var _rexDtLibName=/.*dynatree[^/]*\.js$/i;