a099d68915
Initial Release; Includes Database and MVC refactoring
2 lines
54 KiB
JavaScript
2 lines
54 KiB
JavaScript
(function(n,t,i,r){"use strict";function p(t){t=t||"",n.error("Not implemented: "+t)}function u(t,i){i=": "+i||"",t||n.error("Assertion failed"+i)}function e(n,i){var r,f,u=t.console?t.console[n]:null;if(u)if(u.apply)u.apply(t.console,i);else{for(f="",r=0;r<i.length;r++)f+=i[r];u(f)}}function g(t){for(var r,u,e=n.map(n.trim(t).split("."),function(n){return parseInt(n,10)}),f=n.map(Array.prototype.slice.call(arguments,1),function(n){return parseInt(n,10)}),i=0;i<f.length;i++)if(r=e[i]||0,u=f[i]||0,r!==u)return r>u;return!0}function nt(n,t,i){var r=t[n],u=i[n];return function(){try{return t._super=function(){return r.apply(t,arguments)},u.apply(t,arguments)}finally{t._super=null}}}function tt(t,i,r,u){for(var f in r)typeof r[f]=="function"?typeof t[f]=="function"?t[f]=nt(f,t,r):f.charAt(0)==="_"?t[u][f]=n.proxy(r[f],t):n.error("Could not override tree."+f+". Use prefix '_' to create tree."+u+"._"+f):f!=="options"&&(t[u][f]=i[f])}function c(t,i){return t===r?n.Deferred(function(){this.resolve()}).promise():n.Deferred(function(){this.resolveWith(t,i)}).promise()}function l(t,i){return t===r?n.Deferred(function(){this.reject()}).promise():n.Deferred(function(){this.rejectWith(t,i)}).promise()}function w(n,t){return function(){n.resolveWith(t)}}function b(n){return n=n.toLowerCase(),function(t){return t.title.toLowerCase().indexOf(n)>=0}}function s(t,i){var e,s,r,o;for(this.parent=t,this.tree=t.tree,this.ul=null,this.li=null,this.isStatusNode=!1,this.data={},e=0,s=h.length;e<s;e++)r=h[e],this[r]=i[r];i.data&&n.extend(this.data,i.data);for(r in i)v[r]||n.isFunction(i[r])||d[r]||(this.data[r]=i[r]);this.key==null&&(this.key="_"+f._nextNodeKey++),i.active&&(u(this.tree.activeNode===null,"only one active node allowed"),this.tree.activeNode=this),this.children=null,o=i.children,o&&o.length&&this._setChildren(o)}function y(t){this.widget=t,this.$div=t.element,this.options=t.options,this._id=n.ui.fancytree._nextId++,this._ns=".fancytree-"+this._id,this.activeNode=null,this.focusNode=null,this.lastSelectedNode=null,this.systemFocusElement=null,this.statusClassPropName="span",this.ariaPropName="li",this.nodeContainerAttrName="li",this.$div.find(">ul.fancytree-container").remove();var r={tree:this},i;this.rootNode=new s(r,{title:"root",key:"root_"+this._id,children:null}),this.rootNode.parent=null,i=n("<ul>",{"class":"ui-fancytree fancytree-container"}).appendTo(this.$div),this.$container=i,this.rootNode.ul=i[0],this.options.debugLevel==null&&(this.options.debugLevel=f.debugLevel),this.options.tabbable&&this.$container.attr("tabindex","0"),this.options.aria&&this.$container.attr("role","tree").attr("aria-multiselectable",!0)}if(n.ui.fancytree&&n.ui.fancytree.version){n.ui.fancytree.warn("Fancytree: ignored duplicate include");return}for(var f=null,a="active expanded focus folder lazy selected unselectable".split(" "),k={},h="expanded extraClasses folder hideCheckbox key lazy selected title tooltip unselectable".split(" "),v={},d={active:!0,children:!0,data:!0,focus:!0},o=0;o<a.length;o++)k[a[o]]=!0;for(o=0;o<h.length;o++)v[h[o]]=!0;s.prototype={_findDirectChild:function(n){var t,r,i=this.children;if(i)if(typeof n=="string"){for(t=0,r=i.length;t<r;t++)if(i[t].key===n)return i[t]}else{if(typeof n=="number")return this.children[n];if(n.parent===this)return n}return null},_setChildren:function(n){u(n&&(!this.children||this.children.length===0),"only init supported"),this.children=[];for(var t=0,i=n.length;t<i;t++)this.children.push(new s(this,n[t]))},addChildren:function(t,i){var r,o,e,h=null,f=[];for(n.isPlainObject(t)&&(t=[t]),this.children||(this.children=[]),r=0,o=t.length;r<o;r++)f.push(new s(this,t[r]));return h=f[0],i==null?this.children=this.children.concat(f):(i=this._findDirectChild(i),e=n.inArray(i,this.children),u(e>=0,"insertBefore must be an existing child"),this.children.splice.apply(this.children,[e,0].concat(f))),(!this.parent||this.parent.ul)&&this.render(),this.tree.options.selectMode===3&&this.fixSelection3FromEndNodes(),h},addNode:function(n,t){(t===r||t==="over")&&(t="child");switch(t){case"after":return this.getParent().addChildren(n,this.getNextSibling());case"before":return this.getParent().addChildren(n,this);case"child":case"over":return this.addChildren(n)}u(!1,"Invalid mode: "+t)},applyPatch:function(t){if(t===null)return this.remove(),c(this);var i,r,u={children:!0,expanded:!0,parent:!0};for(i in t)r=t[i],u[i]||n.isFunction(r)||(v[i]?this[i]=r:this.data[i]=r);return t.hasOwnProperty("children")&&(this.removeChildren(),t.children&&this._setChildren(t.children)),this.isVisible()&&(this.renderTitle(),this.renderStatus()),t.hasOwnProperty("expanded")?this.setExpanded(t.expanded):c(this)},collapseSiblings:function(){return this.tree._callHook("nodeCollapseSiblings",this)},copyTo:function(n,t,i){return n.addNode(this.toDict(!0,i),t)},countChildren:function(n){var r=this.children,t,u,i;if(!r)return 0;if(i=r.length,n!==!1)for(t=0,u=i;t<u;t++)i+=r[t].countChildren();return i},debug:function(){this.tree.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),e("debug",arguments))},discard:function(){if(this.lazy&&n.isArray(this.children))return this.removeChildren(),this.setExpanded(!1)},findAll:function(t){t=n.isFunction(t)?t:b(t);var i=[];return this.visit(function(n){t(n)&&i.push(n)}),i},findFirst:function(t){t=n.isFunction(t)?t:b(t);var i=null;return this.visit(function(n){if(t(n))return i=n,!1}),i},_changeSelectStatusAttrs:function(n){var t=!1;switch(n){case!1:t=this.selected||this.partsel,this.selected=!1,this.partsel=!1;break;case!0:t=!this.selected||!this.partsel,this.selected=!0,this.partsel=!0;break;case r:t=this.selected||!this.partsel,this.selected=!1,this.partsel=!0;break;default:u(!1,"invalid state: "+n)}return this.debug("fixSelection3AfterLoad() _changeSelectStatusAttrs()",n,t),t&&this.renderStatus(),t},fixSelection3AfterClick:function(){var n=this.isSelected();this.visit(function(t){t._changeSelectStatusAttrs(n)}),this.fixSelection3FromEndNodes()},fixSelection3FromEndNodes:function(){function n(t){var i,h,c,f,u,e,o,s=t.children;if(s){for(e=!0,o=!1,i=0,h=s.length;i<h;i++)c=s[i],f=n(c),f!==!1&&(o=!0),f!==!0&&(e=!1);u=e?!0:o?r:!1}else u=!!t.selected;return t._changeSelectStatusAttrs(u),u}u(this.tree.options.selectMode===3,"expected selectMode 3"),n(this),this.visitParents(function(n){for(var t,f,e=n.children,o=!0,s=!1,i=0,u=e.length;i<u;i++)t=e[i],(t.selected||t.partsel)&&(s=!0),t.unselectable||t.selected||(o=!1);f=o?!0:s?r:!1,n._changeSelectStatusAttrs(f)})},fromDict:function(t){for(var i in t)v[i]?this[i]=t[i]:i==="data"?n.extend(this.data,t.data):n.isFunction(t[i])||d[i]||(this.data[i]=t[i]);t.children?(this.removeChildren(),this.addChildren(t.children)):this.renderTitle()},getChildren:function(){return this.hasChildren()===r?r:this.children},getFirstChild:function(){return this.children?this.children[0]:null},getIndex:function(){return n.inArray(this,this.parent.children)},getIndexHier:function(t){t=t||".";var i=[];return n.each(this.getParentList(!1,!0),function(n,t){i.push(t.getIndex()+1)}),i.join(t)},getKeyPath:function(n){var t=[],i=this.tree.options.keyPathSeparator;return this.visitParents(function(n){n.parent&&t.unshift(n.key)},!n),i+t.join(i)},getLastChild:function(){return this.children?this.children[this.children.length-1]:null},getLevel:function(){for(var t=0,n=this.parent;n;)t++,n=n.parent;return t},getNextSibling:function(){if(this.parent)for(var t=this.parent.children,n=0,i=t.length-1;n<i;n++)if(t[n]===this)return t[n+1];return null},getParent:function(){return this.parent},getParentList:function(n,t){for(var r=[],i=t?this:this.parent;i;)(n||i.parent)&&r.unshift(i),i=i.parent;return r},getPrevSibling:function(){if(this.parent)for(var t=this.parent.children,n=1,i=t.length;n<i;n++)if(t[n]===this)return t[n-1];return null},hasChildren:function(){return this.lazy?this.children===null||this.children===r?r:this.children.length===0?!1:this.children.length===1&&this.children[0].isStatusNode?r:!0:!!this.children},hasFocus:function(){return this.tree.hasFocus()&&this.tree.focusNode===this},isActive:function(){return this.tree.activeNode===this},isChildOf:function(n){return this.parent&&this.parent===n},isDescendantOf:function(n){if(!n||n.tree!==this.tree)return!1;for(var t=this.parent;t;){if(t===n)return!0;t=t.parent}return!1},isExpanded:function(){return!!this.expanded},isFirstSibling:function(){var n=this.parent;return!n||n.children[0]===this},isFolder:function(){return!!this.folder},isLastSibling:function(){var n=this.parent;return!n||n.children[n.children.length-1]===this},isLazy:function(){return!!this.lazy},isLoading:function(){p()},isRoot:function(){return this.tree.rootNode===this},isSelected:function(){return!!this.selected},isVisible:function(){for(var i=this.getParentList(!1,!1),n=0,t=i.length;n<t;n++)if(!i[n].expanded)return!1;return!0},makeVisible:function(){for(var i=this.getParentList(!1,!1),n=0,t=i.length;n<t;n++)i[n].setExpanded(!0)},moveTo:function(t,i,f){(i===r||i==="over")&&(i="child");var o,s=this.parent,e=i==="child"?t:t.parent;if(this!==t){if(this.parent){if(e.isDescendantOf(this))throw"Cannot move a node to it's own descendant";}else throw"Cannot move system root";if(this.parent.children.length===1?(this.parent.children=this.parent.lazy?[]:null,this.parent.expanded=!1):(o=n.inArray(this,this.parent.children),u(o>=0),this.parent.children.splice(o,1)),this.parent=e,e.hasChildren())switch(i){case"child":e.children.push(this);break;case"before":o=n.inArray(t,e.children),u(o>=0),e.children.splice(o,0,this);break;case"after":o=n.inArray(t,e.children),u(o>=0),e.children.splice(o+1,0,this);break;default:throw"Invalid mode "+i;}else e.children=[this];f&&t.visit(f,!0),this.tree!==t.tree&&(this.warn("Cross-tree moveTo is experimantal!"),this.visit(function(n){n.tree=t.tree},!0)),s.isDescendantOf(e)||s.render(),e.isDescendantOf(s)||e===s||e.render()}},lazyLoad:function(t){t?this.discard():u(!n.isArray(this.children));var i=this.tree._triggerNodeEvent("lazyload",this);return u(typeof i!="boolean","lazyload event must return source in data.result"),this.tree._callHook("nodeLoadChildren",this,i)},render:function(n,t){return this.tree._callHook("nodeRender",this,n,t)},renderTitle:function(){return this.tree._callHook("nodeRenderTitle",this)},renderStatus:function(){return this.tree._callHook("nodeRenderStatus",this)},remove:function(){return this.parent.removeChild(this)},removeChild:function(n){return this.tree._callHook("nodeRemoveChild",this,n)},removeChildren:function(){return this.tree._callHook("nodeRemoveChildren",this)},scheduleAction:function(n,t){this.tree.timer&&clearTimeout(this.tree.timer),this.tree.timer=null;var i=this;switch(n){case"cancel":break;case"expand":this.tree.timer=setTimeout(function(){i.tree.debug("setTimeout: trigger expand"),i.setExpanded(!0)},t);break;case"activate":this.tree.timer=setTimeout(function(){i.tree.debug("setTimeout: trigger activate"),i.setActive(!0)},t);break;default:throw"Invalid mode "+n;}},scrollIntoView:function(t,i){t=t===!0?{duration:200,queue:!1}:t;var h,e=new n.Deferred,r=n(this.span).position().top,c=n(this.span).height(),u=this.tree.$container,o=u[0].scrollTop,l=Math.max(0,u.innerHeight()-u[0].clientHeight),s=u.height()-l,f=null;return r<0?f=o+r:r+c>s&&(f=o+r-s+c,i&&(h=i?n(i.span).position().top:0,r-h>s&&(f=o+r))),f!==null?t?u.animate({scrollTop:f},t):(u[0].scrollTop=f,e.resolveWith(this)):e.resolveWith(this),e.promise()},setActive:function(n){return this.tree._callHook("nodeSetActive",this,n)},setExpanded:function(n){return this.tree._callHook("nodeSetExpanded",this,n)},setFocus:function(n){return this.tree._callHook("nodeSetFocus",this,n)},setSelected:function(n){return this.tree._callHook("nodeSetSelected",this,n)},setTitle:function(n){this.title=n,this.renderTitle()},sortChildren:function(n,t){var i,u,r=this.children;if(r){if(n=n||function(n,t){var i=n.title.toLowerCase(),r=t.title.toLowerCase();return i===r?0:i>r?1:-1},r.sort(n),t)for(i=0,u=r.length;i<u;i++)r[i].children&&r[i].sortChildren(n,"$norender$");t!=="$norender$"&&this.render()}},toDict:function(t,i){var u,o,f,r={},e=this;if(n.each(h,function(n,t){(e[t]||e[t]===!1)&&(r[t]=e[t])}),n.isEmptyObject(this.data)||(r.data=n.extend({},this.data),n.isEmptyObject(r.data)&&delete r.data),i&&i(r),t&&this.hasChildren())for(r.children=[],u=0,o=this.children.length;u<o;u++)f=this.children[u],f.isStatusNode||r.children.push(f.toDict(!0,i));return r},toggleExpanded:function(){return this.tree._callHook("nodeToggleExpanded",this)},toggleSelected:function(){return this.tree._callHook("nodeToggleSelected",this)},toString:function(){return"<FancytreeNode(#"+this.key+", '"+this.title+"')>"},visit:function(n,t){var r,f,i=!0,u=this.children;if(t===!0&&(i=n(this),i===!1||i==="skip"))return i;if(u)for(r=0,f=u.length;r<f;r++)if(i=u[r].visit(n,!0),i===!1)break;return i},visitParents:function(n,t){if(t&&n(this)===!1)return!1;for(var i=this.parent;i;){if(n(i)===!1)return!1;i=i.parent}return!0},warn:function(){Array.prototype.unshift.call(arguments,this.toString()),e("warn",arguments)}},y.prototype={_makeHookContext:function(t,i){if(t.node!==r)return i&&t.originalEvent!==i&&n.error("invalid args"),t;if(t.tree){var u=t.tree;return{node:t,tree:u,widget:u.widget,options:u.widget.options,originalEvent:i}}if(t.widget)return{node:null,tree:t,widget:t.widget,options:t.widget.options,originalEvent:i};n.error("invalid args")},_callHook:function(t,i){var f=this._makeHookContext(i),r=this[t],u=Array.prototype.slice.call(arguments,2);return n.isFunction(r)||n.error("_callHook('"+t+"') is not a function"),u.unshift(f),r.apply(this,u)},activateKey:function(n){var t=this.getNodeByKey(n);return t?t.setActive():this.activeNode&&this.activeNode.setActive(!1),t},applyPatch:function(t){for(var o,r,f,s,e,c=t.length,h=[],i=0;i<c;i++)r=t[i],u(r.length===2,"patchList must be an array of length-2-arrays"),f=r[0],s=r[1],e=f===null?this.rootNode:this.getNodeByKey(f),e?(o=new n.Deferred,h.push(o),e.applyPatch(s).always(w(o,e))):this.warn("could not find node with key '"+f+"'");return n.when.apply(n,h).promise()},count:function(){return this.rootNode.countChildren()},debug:function(){this.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),e("debug",arguments))},generateFormElements:function(t,i){var u,f=t!==!1?"ft_"+this._id:t,e=i!==!1?"ft_"+this._id+"_active":i,o="fancytree_result_"+this._id,r=this.$container.find("div#"+o);r.length?r.empty():r=n("<div>",{id:o}).hide().appendTo(this.$container),f&&(u=this.getSelectedNodes(this.options.selectMode===3),n.each(u,function(t,i){r.append(n("<input>",{type:"checkbox",name:f,value:i.key,checked:!0}))})),e&&this.activeNode&&r.append(n("<input>",{type:"radio",name:e,value:this.activeNode.key,checked:!0}))},getActiveNode:function(){return this.activeNode},getFirstChild:function(){return this.rootNode.getFirstChild()},getFocusNode:function(){return this.focusNode},getNodeByKey:function(n,t){var r,u;return!t&&(r=i.getElementById(this.options.idPrefix+n),r)?r.ftnode?r.ftnode:null:(t=t||this.rootNode,u=null,t.visit(function(t){if(t.key===n)return u=t,!1},!0),u)},getSelectedNodes:function(n){var t=[];return this.rootNode.visit(function(i){if(i.selected&&(t.push(i),n===!0))return"skip"}),t},hasFocus:function(){return f.focusTree===this},info:function(){this.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),e("info",arguments))},loadKeyPath:function(t,i,u){function b(n,t,r){i.call(h,t,"loading"),t.lazyLoad().done(function(){h.loadKeyPath.call(h,o[n],i,t).always(w(r,h))}).fail(function(){h.warn("loadKeyPath: error loading: "+n+" (parent: "+l+")"),i.call(h,t,"error"),r.reject()})}var y,p,a,c,f,o,e,s,l=u||this.rootNode,v=this.options.keyPathSeparator,h=this;for(n.isArray(t)||(t=[t]),o={},a=0;a<t.length;a++)for(c=t[a],c.charAt(0)===v&&(c=c.substr(1)),s=c.split(v);s.length;)if(f=s.shift(),e=l._findDirectChild(f),e)if(s.length===0){i.call(this,e,"ok");break}else if(e.lazy&&e.hasChildren()===r){i.call(this,e,"loaded"),o[f]?o[f].push(s.join(v)):o[f]=[s.join(v)];break}else i.call(this,e,"loaded"),l=e;else{this.warn("loadKeyPath: key not found: "+f+" (parent: "+l+")"),i.call(this,f,"error");break}y=[];for(f in o)e=l._findDirectChild(f),p=new n.Deferred,y.push(p),b(f,e,p);return n.when.apply(n,y).promise()},nodeClick:function(n){var t,i,r=n.originalEvent,u=n.targetType,f=n.node;if(u==="expander")this._callHook("nodeToggleExpanded",n);else if(u==="checkbox")this._callHook("nodeToggleSelected",n),this._callHook("nodeSetFocus",n,!0);else{if(i=!1,t=!0,f.folder)switch(n.options.clickFolderMode){case 2:i=!0,t=!1;break;case 3:t=!0,i=!0}t&&(this.nodeSetFocus(n),this._callHook("nodeSetActive",n,!0)),i&&(!t,this._callHook("nodeToggleExpanded",n))}r.target.localName==="a"&&r.target.className==="fancytree-title"&&r.preventDefault()},nodeCollapseSiblings:function(n){var i,t,u,r=n.node;if(r.parent)for(i=r.parent.children,t=0,u=i.length;t<u;t++)i[t]!==r&&i[t].expanded&&this._callHook("nodeSetExpanded",i[t],!1)},nodeDblclick:function(n){n.targetType==="title"&&n.options.clickFolderMode===4&&this._callHook("nodeToggleExpanded",n),n.targetType==="title"&&n.originalEvent.preventDefault()},nodeKeydown:function(t){function e(n){if(n)return n.makeVisible(),h.ctrlKey||!c.autoActivate?n.setFocus():n.setActive()}var o,s,h=t.originalEvent,i=t.node,f=t.tree,c=t.options,l=!0,u=n.ui.keyCode,r=null;i||(this.rootNode.getFirstChild().setFocus(),i=t.node=this.focusNode,i.debug("Keydown force focus on first node"));switch(h.which){case u.NUMPAD_ADD:case 187:f.nodeSetExpanded(t,!0);break;case u.NUMPAD_SUBTRACT:case 189:f.nodeSetExpanded(t,!1);break;case u.SPACE:c.checkbox?f.nodeToggleSelected(t):f.nodeSetActive(t,!0);break;case u.ENTER:f.nodeSetActive(t,!0);break;case u.BACKSPACE:e(i.parent);break;case u.LEFT:i.expanded?(f.nodeSetExpanded(t,!1),e(i)):i.parent&&i.parent.parent&&e(i.parent);break;case u.RIGHT:!i.expanded&&(i.children||i.lazy)?(f.nodeSetExpanded(t,!0),e(i)):i.children&&e(i.children[0]);break;case u.UP:for(r=i.getPrevSibling();r&&r.expanded&&r.children;)r=r.children[r.children.length-1];!r&&i.parent&&i.parent.parent&&(r=i.parent),e(r);break;case u.DOWN:if(i.expanded&&i.children)r=i.children[0];else for(s=i.getParentList(!1,!0),o=s.length-1;o>=0;o--)if(r=s[o].getNextSibling(),r)break;e(r);break;default:l=!1}l&&h.preventDefault()},nodeLoadChildren:function(t,i){var o,h,f,r,e=t.tree,s=t.node,c=this;if(n.isFunction(i)&&(i=i()),i.url||n.isFunction(i.done)){if(e.nodeSetStatus(t,"loading"),i.url){if(o=n.extend({},t.options.ajax,i),o.debugLazyDelay)return f=o.debugLazyDelay,n.isArray(f)&&(f=f[0]+Math.random()*(f[1]-f[0])),s.debug("nodeLoadChildren waiting debug delay "+Math.round(f)+"ms"),r=n.Deferred(),setTimeout(function(){o.debugLazyDelay=!1,c.nodeLoadChildren(t,o).complete(function(){r.resolve.apply(this,arguments)})},f),r;r=n.ajax(o)}else r=i;r.done(function(i){var r;e.nodeSetStatus(t,"ok"),typeof i=="string"&&n.error("Ajax request returned a string (did you get the JSON dataType wrong?)."),t.options.postProcess?(r=e._triggerNodeEvent("postProcess",t,t.originalEvent,{response:i,dataType:this.dataType}),i=n.isArray(r)?r:i):i&&i.hasOwnProperty("d")&&t.options.enableAspx&&(i=typeof i.d=="string"?n.parseJSON(i.d):i.d),h=i}).fail(function(n,i,r){e.nodeSetStatus(t,"error",i,n.status+": "+r),alert("error: "+i+" ("+n.status+": "+(r.message||r)+")")})}else r=n.Deferred(),h=i,r.resolve();return r.done(function(){u(n.isArray(h),"expected array of children"),s._setChildren(h),s.parent&&(s.isVisible()&&e.nodeRender(t),e._triggerNodeEvent("loadChildren",s))}).fail(function(){e.nodeRender(t)}),r},nodeLoadKeyPath:function(){},nodeMakeVisible:function(n){for(var r=n.node.getParentList(!1,!1),t=0,i=r.length;t<i;t++)r[t].setExpanded(!0)},nodeRemoveChild:function(t,i){var e,s=t.node,h=t.options,o=n.extend({},t,{node:i}),r=s.children;if(f.debug("nodeRemoveChild()",s.toString(),i.toString()),r.length===1)return u(i===r[0]),this.nodeRemoveChildren(t);this.activeNode&&(i===this.activeNode||this.activeNode.isDescendantOf(i))&&this.activeNode.setActive(!1),this.focusNode&&(i===this.focusNode||this.focusNode.isDescendantOf(i))&&(this.focusNode=null),this.nodeRemoveMarkup(o),this.nodeRemoveChildren(o),e=n.inArray(i,r),u(e>=0),i.visit(function(n){n.parent=null},!0),h.removeNode&&h.removeNode.call(t.tree,{type:"removeNode"},o),r.splice(e,1)},nodeRemoveChildMarkup:function(t){var i=t.node;f.debug("nodeRemoveChildMarkup()",i.toString()),i.ul&&(n(i.ul).remove(),i.visit(function(n){n.li=n.ul=null}),i.ul=null)},nodeRemoveChildren:function(t){var u,i=t.node,o=i.children,e=t.options;(f.debug("nodeRemoveChildren()",i.toString()),o)&&(this.activeNode&&this.activeNode.isDescendantOf(i)&&this.activeNode.setActive(!1),this.focusNode&&this.focusNode.isDescendantOf(i)&&(this.focusNode=null),this.nodeRemoveChildMarkup(t),u=n.extend({},t),i.visit(function(n){n.parent=null,e.removeNode&&(u.node=n,e.removeNode.call(t.tree,{type:"removeNode"},u))}),i.children=r,this.nodeRenderStatus(t))},nodeRemoveMarkup:function(t){var i=t.node;f.debug("nodeRemoveMarkup()",i.toString()),i.li&&(n(i.li).remove(),i.li=null),this.nodeRemoveChildMarkup(t)},nodeRender:function(t,r,f,e,o){var a,v,y,h,p,d,s=t.node,g=t.tree,c=t.options,b=c.aria,nt=!1,k=s.parent,w=!k,l=s.children;if(u(w||k.ul,"parent UL must exist"),w||(s.li&&(r||s.li.parentNode!==s.parent.ul)&&(s.li.parentNode!==s.parent.ul&&this.warn("unlink "+s+" (must be child of "+s.parent+")"),this.nodeRemoveMarkup(t)),s.li||(nt=!0,s.li=i.createElement("li"),s.li.ftnode=s,b,s.key&&c.generateIds&&(s.li.id=c.idPrefix+s.key),s.span=i.createElement("span"),s.span.className="fancytree-node",b&&n(s.span).attr("aria-labelledby","ftal_"+s.key),s.li.appendChild(s.span),this.nodeRenderTitle(t),c.createNode&&c.createNode.call(g,{type:"createNode"},t)),c.renderNode&&c.renderNode.call(g,{type:"renderNode"},t)),l){if(w||s.expanded||f===!0){for(s.ul||(s.ul=i.createElement("ul"),(e!==!0||o)&&s.expanded||(s.ul.style.display="none"),b&&n(s.ul).attr("role","group"),s.li.appendChild(s.ul)),h=0,p=l.length;h<p;h++)d=n.extend({},t,{node:l[h]}),this.nodeRender(d,r,f,!1,!0);for(a=s.ul.firstChild,h=0,p=l.length-1;h<p;h++)v=l[h],y=a.ftnode,v!==y?(s.debug("_fixOrder: mismatch at index "+h+": "+v+" != "+y),s.ul.insertBefore(v.li,y.li)):a=a.nextSibling}}else s.ul&&(this.warn("remove child markup for "+s),this.nodeRemoveChildMarkup(t));w||(this.nodeRenderStatus(t),nt&&k.ul.appendChild(s.li));return},nodeRenderTitle:function(n,t){var c,l,s,h,a,i=n.node,y=n.tree,f=n.options,o=f.aria,v=i.getLevel(),u=[],e=i.data.icon;(t!==r&&(i.title=t),i.span)&&(v<f.minExpandLevel?v>1&&(o?u.push("<span role='button' class='fancytree-expander'><\/span>"):u.push("<span class='fancytree-expander'><\/span>")):o?u.push("<span role='button' class='fancytree-expander'><\/span>"):u.push("<span class='fancytree-expander'><\/span>"),f.checkbox&&i.hideCheckbox!==!0&&!i.isStatusNode&&(o?u.push("<span role='checkbox' class='fancytree-checkbox'><\/span>"):u.push("<span class='fancytree-checkbox'><\/span>")),h=o?" role='img'":"",e&&typeof e=="string"?(l=e.charAt(0)==="/"?e:f.imagePath+e,u.push("<img src='"+l+"' alt='' />")):i.data.iconclass?u.push("<span "+h+" class='fancytree-custom-icon "+i.data.iconclass+"'><\/span>"):(e===!0||e!==!1&&f.icons!==!1)&&u.push("<span "+h+" class='fancytree-icon'><\/span>"),s="",f.renderTitle&&(s=f.renderTitle.call(y,{type:"renderTitle"},n)||""),s||(a=i.tooltip?" title='"+i.tooltip.replace(/\"/g,""")+"'":"",c=o?" id='ftal_"+i.key+"'":"",h=o?" role='treeitem'":"",s="<span "+h+" class='fancytree-title'"+c+a+">"+i.title+"<\/span>"),u.push(s),i.span.innerHTML=u.join(""))},nodeRenderStatus:function(t){var i=t.node,o=t.tree,h=t.options,c=i.hasChildren(),s=i.isLastSibling(),f=h.aria,e=n(i.span).find(".fancytree-title"),u=h._classNames,r=[],l=i[o.statusClassPropName];l&&(r.push(u.node),o.activeNode===i&&r.push(u.active),o.focusNode===i?(r.push(u.focused),f&&e.attr("aria-activedescendant",!0)):f&&e.removeAttr("aria-activedescendant"),i.expanded?(r.push(u.expanded),f&&e.attr("aria-expanded",!0)):f&&e.removeAttr("aria-expanded"),i.folder&&r.push(u.folder),c!==!1&&r.push(u.hasChildren),s&&r.push(u.lastsib),i.lazy&&i.children===null&&r.push(u.lazy),i.partsel&&r.push(u.partsel),i.selected?(r.push(u.selected),f&&e.attr("aria-selected",!0)):f&&e.attr("aria-selected",!1),i.extraClasses&&r.push(i.extraClasses),c===!1?r.push(u.combinedExpanderPrefix+"n"+(s?"l":"")):r.push(u.combinedExpanderPrefix+(i.expanded?"e":"c")+(i.lazy&&i.children===null?"d":"")+(s?"l":"")),r.push(u.combinedIconPrefix+(i.expanded?"e":"c")+(i.folder?"f":"")),i[o.statusClassPropName].className=r.join(" "),i.li&&(i.li.className=s?u.lastsib:""))},nodeSetActive:function(t,i){var e,f=t.node,r=t.tree,o=t.options,s=f===r.activeNode;if(i=i!==!1,f.debug("nodeSetActive",i),s===i)return c(f);if(i&&this._triggerNodeEvent("beforeActivate",f,t.originalEvent)===!1)return l(f,["rejected"]);i?(r.activeNode&&(u(r.activeNode!==f,"node was active (inconsistency)"),e=n.extend({},t,{node:r.activeNode}),r.nodeSetActive(e,!1),u(r.activeNode===null,"deactivate was out of sync?")),o.activeVisible&&r.nodeMakeVisible(t),r.activeNode=f,r.nodeRenderStatus(t),r.nodeSetFocus(t),r._triggerNodeEvent("activate",f)):(u(r.activeNode===f,"node was not active (inconsistency)"),r.activeNode=null,this.nodeRenderStatus(t),t.tree._triggerNodeEvent("deactivate",f))},nodeSetExpanded:function(t,i){var s,f,o,a,h,v,u=t.node,y=t.tree,e=t.options;if(i=i!==!1,u.debug("nodeSetExpanded("+i+")"),u.expanded&&i||!u.expanded&&!i)return u.debug("nodeSetExpanded("+i+"): nothing to do"),c(u);if(!i||u.lazy||u.hasChildren()){if(!i&&u.getLevel()<e.minExpandLevel)return l(u,["locked"]);if(this._triggerNodeEvent("beforeExpand",u,t.originalEvent)===!1)return l(u,["rejected"])}else return l(u,["empty"]);if(f=new n.Deferred,i&&!u.expanded&&e.autoCollapse){h=u.getParentList(!1,!0),v=e.autoCollapse;try{for(e.autoCollapse=!1,o=0,a=h.length;o<a;o++)this._callHook("nodeCollapseSiblings",h[o])}finally{e.autoCollapse=v}}return f.done(function(){t.tree._triggerNodeEvent(i?"expand":"collapse",t),e.autoScroll&&u.getLastChild().scrollIntoView(!0,u)}),s=function(){var r,o,s,h;u.expanded=i,y._callHook("nodeRender",t,!1,!1,!0),u.ul?(s=u.ul.style.display!=="none",h=!!u.expanded,s===h?(u.warn("nodeSetExpanded: UL.style.display already set"),f.resolveWith(u)):e.fx?(r=e.fx.duration||200,o=e.fx.easing,u.debug("nodeSetExpanded: animate start..."),n(u.ul).animate(e.fx,r,o,function(){u.debug("nodeSetExpanded: animate done"),f.resolveWith(u)})):(u.ul.style.display=u.expanded||!parent?"":"none",f.resolveWith(u))):f.resolveWith(u)},i&&u.lazy&&u.hasChildren()===r?(u.debug("nodeSetExpanded: load start..."),u.lazyLoad().done(function(){u.debug("nodeSetExpanded: load done"),f.notifyWith&&f.notifyWith(u,["loaded"]),s.call(y)}).fail(function(n){f.rejectWith(u,["load failed ("+n+")"])})):s(),u.debug("nodeSetExpanded: returns"),f.promise()},nodeSetFocus:function(t,i){t.node.debug("nodeSetFocus("+i+")");var e,r=t.tree,u=t.node;if(i=i!==!1,r.focusNode){if(r.focusNode===u&&i){u.debug("nodeSetFocus("+i+"): nothing to do");return}e=n.extend({},t,{node:r.focusNode}),r.focusNode=null,this._triggerNodeEvent("blur",e),this._callHook("nodeRenderStatus",e)}i&&(f.focusTree!==r&&(u.debug("nodeSetFocus: forcing container focus"),this._callHook("treeSetFocus",t,!0,!0)),this.nodeMakeVisible(t),r.focusNode=u,this._triggerNodeEvent("focus",t),t.options.autoScroll&&u.scrollIntoView(),this._callHook("nodeRenderStatus",t))},nodeSetSelected:function(n,t){var i=n.node,r=n.tree,u=n.options;if(t=t!==!1,i.debug("nodeSetSelected("+t+")",n),!i.unselectable){if(i.selected&&t||!i.selected&&!t||this._triggerNodeEvent("beforeSelect",i,n.originalEvent)===!1)return!!i.selected;t&&u.selectMode===1?r.lastSelectedNode&&r.lastSelectedNode.setSelected(!1):u.selectMode===3&&(i.selected=t,i.fixSelection3AfterClick()),i.selected=t,this.nodeRenderStatus(n),r.lastSelectedNode=t?i:null,r._triggerNodeEvent("select",n)}},nodeSetStatus:function(t,i,r,u){var s,o,f=t.node,e=t.tree;s=function(){var n=f.children?f.children[0]:null;if(n&&n.isStatusNode){try{f.ul&&(f.ul.removeChild(n.li),n.li=null)}catch(t){}f.children.length===1?f.children=[]:f.children.shift()}return},o=function(t){var i=f.children?f.children[0]:null;return i&&i.isStatusNode?(n.extend(i,t),e._callHook("nodeRender",i)):(t.key="_statusNode",f._setChildren([t]),f.children[0].isStatusNode=!0,e.render()),f.children[0]};switch(i){case"ok":s(),n(f.span).removeClass("fancytree-loading");break;case"loading":n(f.span).addClass("fancytree-loading"),f.parent||o({title:e.options.strings.loading+(r?" ("+r+") ":""),tooltip:u,extraClasses:"fancytree-statusnode-wait"});break;case"error":n(f.span).addClass("fancytree-error"),o({title:e.options.strings.loadError+" ("+r+")",tooltip:u,extraClasses:"fancytree-statusnode-error"});break;default:n.error("invalid status "+i)}},nodeToggleExpanded:function(n){return this.nodeSetExpanded(n,!n.node.expanded)},nodeToggleSelected:function(n){return this.nodeSetSelected(n,!n.node.selected)},treeClear:function(n){var t=n.tree;t.activeNode=null,t.focusNode=null,t.$div.find(">ul.fancytree-container").empty(),t.rootNode.children=null},treeCreate:function(){},treeDestroy:function(){},treeInit:function(n){this.treeLoad(n)},treeLoad:function(t,i){var u,f,r=t.tree,e=t.widget.element,o=n.extend({},t,{node:this.rootNode});if(r.rootNode.children&&this.treeClear(t),i=i||this.options.source,i)typeof i=="string"&&p();else{u=e.data("type")||"html";switch(u){case"html":f=e.find(">ul:first"),f.addClass("ui-fancytree-source ui-helper-hidden"),i=n.ui.fancytree.parseHtml(f);break;case"json":i=n.parseJSON(e.text()),i.children&&(i.title&&(r.title=i.title),i=i.children);break;default:n.error("Invalid data-type: "+u)}}return this.nodeLoadChildren(o,i).done(function(){r.render(),t.options.selectMode===3&&r.rootNode.fixSelection3FromEndNodes(),r._triggerTreeEvent("init",!0)}).fail(function(){r.render(),r._triggerTreeEvent("init",!1)})},treeOnFocusInOut:function(t){var i=t.type==="focusin",r=n.ui.fancytree.getNode(t);try{this.debug("treeOnFocusInOut("+i+"), node=",r),u(!this._inFocusHandler,"Focus handler recursion"),this.systemFocusElement=i?t.target:null,this._inFocusHandler=!0,r?this._callHook("nodeSetFocus",r,i):this._callHook("treeSetFocus",this,i)}finally{this._inFocusHandler=!1}},treeSetFocus:function(n,t,i){t=t!==!1,this.debug("treeSetFocus("+t+"), _calledByNodeSetFocus: "+i),this.debug(" focusNode: "+this.focusNode),this.debug(" activeNode: "+this.activeNode),f.focusTree&&(this===f.focusTree&&t||(f.focusTree.focusNode&&f.focusTree.focusNode.setFocus(!1),f.focusTree.$container.removeClass("fancytree-focused"),this._triggerTreeEvent("blurTree"),f.focusTree=null)),t&&f.focusTree!==this?(f.focusTree=this,this.$container.addClass("fancytree-focused"),this.systemFocusElement||(this.debug("Set `:focus` to container"),this.$container.focus()),this.focusNode||i||(this.activeNode?this.activeNode.setFocus():this.rootNode.hasChildren()&&this.warn("NOT setting focus to first child")),this._triggerTreeEvent("focusTree")):f.focusTree=null},reactivate:function(n){var t=this.activeNode;t&&(this.activeNode=null,t.setActive(),n&&t.setFocus())},reload:function(n){return this._callHook("treeClear",this),this._callHook("treeLoad",this,n)},render:function(n,t){return this.rootNode.render(n,t)},setFocus:function(n){return this._callHook("treeSetFocus",this,n)},toDict:function(n,t){var i=this.rootNode.toDict(!0,t);return n?i:i.children},toString:function(){return"<Fancytree(#"+this._id+")>"},_triggerNodeEvent:function(t,i,u,f){var o,e=this._makeHookContext(i,u);return(f&&n.extend(e,f),o=this.widget._trigger(t,u,e),o!==!1&&e.result!==r)?e.result:o},_triggerTreeEvent:function(n,t){var i=this._makeHookContext(this,t),u=this.widget._trigger(n,t,i);return u!==!1&&i.result!==r?i.result:u},visit:function(n){return this.rootNode.visit(n,!1)},warn:function(){Array.prototype.unshift.call(arguments,this.toString()),e("warn",arguments)}},n.widget("ui.fancytree",{options:{activeVisible:!0,ajax:{type:"GET",cache:!1,dataType:"json"},aria:!1,autoActivate:!0,autoCollapse:!1,autoScroll:!1,checkbox:!1,clickFolderMode:4,debugLevel:null,disabled:!1,enableAspx:!0,extensions:[],fx:{height:"toggle",duration:200},generateIds:!1,icons:!0,idPrefix:"ft_",keyboard:!0,keyPathSeparator:"/",minExpandLevel:1,selectMode:2,strings:{loading:"Loading…",loadError:"Load error!"},tabbable:!0,_classNames:{node:"fancytree-node",folder:"fancytree-folder",combinedExpanderPrefix:"fancytree-exp-",combinedIconPrefix:"fancytree-ico-",hasChildren:"fancytree-has-children",active:"fancytree-active",selected:"fancytree-selected",expanded:"fancytree-expanded",lazy:"fancytree-lazy",focused:"fancytree-focused ui-state-focus",partsel:"fancytree-partsel",lastsib:"fancytree-lastsib"},lazyload:null,postProcess:null},_create:function(){this.tree=new y(this),this.$source=this.source||this.element.data("type")==="json"?this.element:this.element.find(">ul:first");for(var i,t,f=this.options.extensions,e=this.tree,r=0;r<f.length;r++)t=f[r],i=n.ui.fancytree._extensions[t],i||n.error("Could not apply extension '"+t+"' (it is not registered, did you forget to include it?)"),this.tree.options[t]=n.extend(!0,{},i.options,this.tree.options[t]),u(!this.tree[t],"Extension name must not exist as Fancytree attribute: "+t),this.tree[t]={},tt(this.tree,e,i,t),e=i;this.tree._callHook("treeCreate",this.tree)},_init:function(){this.tree._callHook("treeInit",this.tree),this._bind()},_setOption:function(t,i){var r=!0,u=!1;switch(t){case"aria":case"checkbox":case"icons":case"minExpandLevel":case"tabbable":this.tree._callHook("treeCreate",this.tree),u=!0;break;case"source":r=!1,this.tree._callHook("treeLoad",this.tree,i)}this.tree.debug("set option "+t+"="+i+" <"+typeof i+">"),r&&n.Widget.prototype._setOption.apply(this,arguments),u&&this.tree.render(!0,!1)},destroy:function(){this._unbind(),this.tree._callHook("treeDestroy",this.tree),this.tree.$div.find(">ul.fancytree-container").remove(),this.$source&&this.$source.removeClass("ui-helper-hidden"),n.Widget.prototype.destroy.call(this)},_unbind:function(){var t=this.tree._ns;this.element.unbind(t),this.tree.$container.unbind(t),n(i).unbind(t)},_bind:function(){var e=this,u=this.options,t=this.tree,r=t._ns,o=n.support.selectstart?"selectstart":"mousedown";this._unbind(),t.debug("bind events; container: ",t.$container),t.$container.bind("focusin"+r+" focusout"+r,function(n){t.debug("Tree container got event "+n.type),t.treeOnFocusInOut.call(t,n)}).delegate("span.fancytree-title",o+r,function(n){t.debug("<span> got event "+n.type),n.preventDefault()}),n(i).bind("keydown"+r,function(n){if(t.debug("doc got event "+n.type+", hasFocus:"+t.hasFocus()),u.disabled||u.keyboard===!1||!t.hasFocus())return!0;var i=t.focusNode,r=t._makeHookContext(i||t,n),f=t.phase;try{return t.phase="userEvent",i?t._triggerNodeEvent("keydown",i,n)===!1?!1:t._callHook("nodeKeydown",r):t._triggerTreeEvent("keydown",n)===!1?!1:t._callHook("nodeKeydown",r)}finally{t.phase=f}}),this.element.bind("click"+r+" dblclick"+r,function(n){if(u.disabled)return!0;var i,r=f.getEventTarget(n),o=r.node,t=e.tree,s=t.phase;if(!o)return!0;i=t._makeHookContext(o,n);try{t.phase="userEvent";switch(n.type){case"click":return i.targetType=r.type,t._triggerNodeEvent("click",i,n)===!1?!1:t._callHook("nodeClick",i);case"dblclick":return i.targetType=r.type,t._triggerNodeEvent("dblclick",i,n)===!1?!1:t._callHook("nodeDblclick",i)}}finally{t.phase=s}})},getActiveNode:function(){return this.tree.activeNode},getNodeByKey:function(n){return this.tree.getNodeByKey(n)},getRootNode:function(){return this.tree.rootNode},getTree:function(){return this.tree}}),f=n.ui.fancytree,n.extend(n.ui.fancytree,{version:"development",buildType:"release",debugLevel:1,_nextId:1,_nextNodeKey:1,_extensions:{},focusTree:null,_FancytreeClass:y,_FancytreeNodeClass:s,jquerySupports:{positionMyOfs:g(n.ui.version,1,9)},debug:function(){n.ui.fancytree.debugLevel>=2&&e("log",arguments)},error:function(){e("error",arguments)},getEventTargetType:function(n){return this.getEventTarget(n).type},getEventTarget:function(n){var i=n&&n.target?n.target.className:"",t={node:this.getNode(n.target),type:r};return i==="fancytree-title"?t.type="title":i==="fancytree-expander"?t.type=t.node.hasChildren()===!1?"prefix":"expander":i==="fancytree-checkbox"?t.type="checkbox":i==="fancytree-icon"?t.type="icon":i.indexOf("fancytree-node")>=0&&(t.type="title"),t},getNode:function(n){if(n instanceof s)return n;for(n.selector!==r?n=n[0]:n.originalEvent!==r&&(n=n.target);n;){if(n.ftnode)return n.ftnode;n=n.parentNode}return null},info:function(){n.ui.fancytree.debugLevel>=1&&e("info",arguments)},parseHtml:function(t){var l=t.find(">li"),o,i,f,s,u,h,e,c=[];return l.each(function(){var y,w,v=n(this),b=v.find(">span:first",this),p=b.length?null:v.find(">a:first"),l={tooltip:null,data:{}};for(b.length?l.title=b.html():p&&p.length?(l.title=p.html(),l.data.href=p.attr("href"),l.data.target=p.attr("target"),l.tooltip=p.attr("title")):(l.title=v.html(),s=l.title.search(/<ul/i),s>=0&&(l.title=l.title.substring(0,s))),l.title=n.trim(l.title),i=0,f=a.length;i<f;i++)l[a[i]]=r;for(h=this.className.split(" "),o=[],i=0,f=h.length;i<f;i++)e=h[i],k[e]?l[e]=!0:o.push(e);l.extraClasses=o.join(" "),u=v.attr("title"),u&&(l.tooltip=u),u=v.attr("id"),u&&(l.key=u),y=v.data(),y&&!n.isEmptyObject(y)&&(w=y.json,delete y.json,n.extend(l.data,y),w&&n.extend(l.data,w)),t=v.find(">ul:first"),l.children=t.length?n.ui.fancytree.parseHtml(t):l.lazy?r:null,c.push(l)}),c},registerExtension:function(t,i){n.ui.fancytree._extensions[t]=i},warn:function(){e("warn",arguments)}})})(jQuery,window,document),function(n){"use strict";n.ui.fancytree.registerExtension("columnview",{options:{},treeInit:function(t){var f,u,i=t.tree,r=i.widget.element;i.tr=n("tbody tr",r)[0],i.columnCount=n(">td",i.tr).length,this._super(t),u=n(i.rootNode.ul),f=n(">td",i.tr).eq(0),u.removeClass("fancytree-container"),u.removeAttr("tabindex"),i.$container=r,r.addClass("fancytree-container fancytree-ext-columnview"),r.attr("tabindex","0"),f.empty(),u.detach().appendTo(f),i.widget.options.autoCollapse=!0,i.widget.options.fx=!1,i.widget.options.clickFolderMode=1,r.bind("fancytreeactivate",function(t,i){var u,e,r=i.node,f=i.tree,o=r.getLevel();if(f._callHook("nodeCollapseSiblings",r),o<=f.columnCount)for(e=n(">td",f.tr),u=o;u<f.columnCount;u++)e.eq(u).empty();!r.expanded&&(r.children||r.lazy)&&r.setExpanded()}).bind("fancytreekeydown",function(t,i){var r=null;switch(t.which){case n.ui.keyCode.DOWN:return r=i.node.getNextSibling(),r&&r.setFocus(),!1;case n.ui.keyCode.LEFT:return r=i.node.getParent(),r&&r.setFocus(),!1;case n.ui.keyCode.UP:return r=i.node.getPrevSibling(),r&&r.setFocus(),!1}})},nodeRender:function(t,i,r,u,f){this._super(t,i,r,u,f);var o,h,c,l=t.tree,e=t.node,s=n(e.span);s.find("span.fancytree-expander").remove(),e.hasChildren()===!1||s.find("span.fancytree-cv-right").length||s.append(n("<span class='fancytree-icon fancytree-cv-right'>")),e.ul&&(e.ul.style.display="",o=e.getLevel(),o<l.columnCount&&(h=n(">td",l.tr).eq(o),c=n(e.ul).detach(),h.empty().append(c)))}})}(jQuery,window,document),function(n,t,i,r){"use strict";function e(n){return n===0?"":n>0?"+"+n:""+n}function o(t){var i=t.options.dnd||null;i&&s(),i&&i.onDragStart&&t.widget.element.draggable({addClasses:!1,appendTo:"body",containment:!1,delay:0,distance:4,revert:!1,scroll:!0,scrollSpeed:7,scrollSensitivity:10,connectToFancytree:!0,helper:function(t){var i=n.ui.fancytree.getNode(t.target);return i?i.tree.dnd._onDragEvent("helper",i,null,t,null,null):"<div>ERROR?: helper requested but sourceNode not found<\/div>"},start:function(){}}),i&&i.onDrop&&t.widget.element.droppable({addClasses:!1,tolerance:"intersect",greedy:!1})}function s(){f||(n.ui.plugin.add("draggable","connectToFancytree",{start:function(t,i){var r=n(this).data("ui-draggable")||n(this).data("draggable"),u=i.helper.data("ftSourceNode")||null;if(u)return r.offset.click.top=-2,r.offset.click.left=16,u.tree.dnd._onDragEvent("start",u,null,t,i,r)},drag:function(t,i){var s,e=n(this).data("ui-draggable")||n(this).data("draggable"),o=i.helper.data("ftSourceNode")||null,f=i.helper.data("ftTargetNode")||null,r=n.ui.fancytree.getNode(t.target);if(t.target&&!r&&(s=n(t.target).closest("div.fancytree-drag-helper,#fancytree-drop-marker").length>0,s)){u("Drag event over helper: ignored.");return}i.helper.data("ftTargetNode",r),f&&f!==r&&f.tree.dnd._onDragEvent("leave",f,o,t,i,e),r&&r.tree.options.dnd.onDrop&&(r===f?r.tree.dnd._onDragEvent("over",r,o,t,i,e):r.tree.dnd._onDragEvent("enter",r,o,t,i,e))},stop:function(t,i){var e=n(this).data("ui-draggable")||n(this).data("draggable"),r=i.helper.data("ftSourceNode")||null,f=i.helper.data("ftTargetNode")||null,s=t.type,o=s==="mouseup"&&t.which===1;o||u("Drag was cancelled"),f&&(o&&f.tree.dnd._onDragEvent("drop",f,r,t,i,e),f.tree.dnd._onDragEvent("leave",f,r,t,i,e)),r&&r.tree.dnd._onDragEvent("stop",r,null,t,i,e)}}),f=!0)}var u=n.ui.fancytree.debug,f=!1;n.ui.fancytree.registerExtension("dnd",{options:{onDragStart:null,onDragStop:null,autoExpandMS:1e3,preventVoidMoves:!0,preventRecursiveMoves:!0,onDragEnter:null,onDragOver:null,onDrop:null,onDragLeave:null},treeInit:function(n){var t=n.tree;this._super(n),o(t)},nodeKeydown:function(t){var i=t.originalEvent;i.which===n.ui.keyCode.ESCAPE&&this.dnd._cancelDrag(),this._super(t)},_setDndStatus:function(t,i,r,u,f){var a,l=0,c="center",s=this.dnd,h=t?n(t.span):null,o=n(i.span);if(s.$dropMarker||(s.$dropMarker=n("<div id='fancytree-drop-marker'><\/div>").hide().css({"z-index":1e3}).prependTo(n(this.$div).parent())),u==="after"||u==="before"||u==="over"){switch(u){case"before":s.$dropMarker.removeClass("fancytree-drop-after fancytree-drop-over"),s.$dropMarker.addClass("fancytree-drop-before"),c="top";break;case"after":s.$dropMarker.removeClass("fancytree-drop-before fancytree-drop-over"),s.$dropMarker.addClass("fancytree-drop-after"),c="bottom";break;default:s.$dropMarker.removeClass("fancytree-drop-after fancytree-drop-before"),s.$dropMarker.addClass("fancytree-drop-over"),o.addClass("fancytree-drop-target"),l=8}a=n.ui.fancytree.jquerySupports.positionMyOfs?{my:"left"+e(l)+" center",at:"left "+c,of:o}:{my:"left center",at:"left "+c,of:o,offset:""+l+" 0"},s.$dropMarker.show().position(a)}else o.removeClass("fancytree-drop-target"),s.$dropMarker.hide();u==="after"?o.addClass("fancytree-drop-after"):o.removeClass("fancytree-drop-after"),u==="before"?o.addClass("fancytree-drop-before"):o.removeClass("fancytree-drop-before"),f===!0?(h&&h.addClass("fancytree-drop-accept"),o.addClass("fancytree-drop-accept"),r.addClass("fancytree-drop-accept")):(h&&h.removeClass("fancytree-drop-accept"),o.removeClass("fancytree-drop-accept"),r.removeClass("fancytree-drop-accept")),f===!1?(h&&h.addClass("fancytree-drop-reject"),o.addClass("fancytree-drop-reject"),r.addClass("fancytree-drop-reject")):(h&&h.removeClass("fancytree-drop-reject"),o.removeClass("fancytree-drop-reject"),r.removeClass("fancytree-drop-reject"))},_onDragEvent:function(t,i,f,e,o,s){t!=="over"&&u("tree.dnd._onDragEvent(%s, %o, %o) - %o",t,i,f,this);var y,b,k,p,a,h,l,d=this.options,c=d.dnd,v=null,w=n(i.span);switch(t){case"helper":y=n("<div class='fancytree-drag-helper'><span class='fancytree-drag-helper-img' /><\/div>").append(n(e.target).closest("span.fancytree-title").clone()),n("ul.fancytree-container",i.tree.$div).append(y),y.data("ftSourceNode",i),u("helper=%o",y),u("helper.sourceNode=%o",y.data("ftSourceNode")),v=y;break;case"start":i.isStatusNode?v=!1:c.onDragStart&&(v=c.onDragStart(i)),v===!1?(this.debug("tree.onDragStart() cancelled"),o.helper.trigger("mouseup"),o.helper.hide()):w.addClass("fancytree-drag-source");break;case"enter":l=c.preventRecursiveMoves&&i.isDescendantOf(f)?!1:c.onDragEnter?c.onDragEnter(i,f,o,s):null,v=l?n.isArray(l)?{over:n.inArray("over",l)>=0,before:n.inArray("before",l)>=0,after:n.inArray("after",l)>=0}:{over:l===!0||l==="over",before:l===!0||l==="before",after:l===!0||l==="after"}:!1,o.helper.data("enterResponse",v),u("helper.enterResponse: %o",v);break;case"over":a=o.helper.data("enterResponse"),h=null,a===!1||(typeof a=="string"?h=a:(b=w.offset(),k={x:e.pageX-b.left,y:e.pageY-b.top},p={x:k.x/w.width(),y:k.y/w.height()},a.after&&p.y>.75?h="after":!a.over&&a.after&&p.y>.5?h="after":a.before&&p.y<=.25?h="before":!a.over&&a.before&&p.y<=.5?h="before":a.over&&(h="over"),c.preventVoidMoves&&(i===f?(u(" drop over source node prevented"),h=null):h==="before"&&f&&i===f.getNextSibling()?(u(" drop after source node prevented"),h=null):h==="after"&&f&&i===f.getPrevSibling()?(u(" drop before source node prevented"),h=null):h==="over"&&f&&f.parent===i&&f.isLastSibling()&&(u(" drop last child over own parent prevented"),h=null)),o.helper.data("hitMode",h))),h==="over"&&c.autoExpandMS&&i.hasChildren()!==!1&&!i.expanded&&i.scheduleAction("expand",c.autoExpandMS),h&&c.onDragOver&&(v=c.onDragOver(i,f,h,o,s)),this.dnd._setDndStatus(f,i,o.helper,h,v!==!1&&h!==null);break;case"drop":if(h=o.helper.data("hitMode"),h&&c.onDrop)c.onDrop(i,f,h,o,s);break;case"leave":if(i.scheduleAction("cancel"),o.helper.data("enterResponse",null),o.helper.data("hitMode",null),this.dnd._setDndStatus(f,i,o.helper,"out",r),c.onDragLeave)c.onDragLeave(i,f,o,s);break;case"stop":if(w.removeClass("fancytree-drag-source"),c.onDragStop)c.onDragStop(i);break;default:throw"Unsupported drag event: "+t;}return v},_cancelDrag:function(){var t=n.ui.ddmanager.current;t&&t.cancel()}})}(jQuery,window,document),function(n){"use strict";function t(n){return(n+"").replace(/([.?*+\^\$\[\]\\(){}|-])/g,"\\$1")}n.ui.fancytree._FancytreeClass.prototype.applyFilter=function(n){var i,r,u=0;return this.visit(function(n){delete n.match,delete n.subMatch}),typeof n=="string"&&(i=t(n),r=new RegExp(".*"+i+".*","i"),n=function(n){return!!r.exec(n.title)}),this.enableFilter=!0,this.$div.addClass("fancytree-ext-filter"),this.visit(function(t){n(t)&&(u++,t.match=!0,t.visitParents(function(n){n.subMatch=!0}))}),this.render(),u},n.ui.fancytree._FancytreeClass.prototype.clearFilter=function(){this.visit(function(t){delete t.match,delete t.subMatch,n(t.li).show()}),this.enableFilter=!1,this.render(),this.$div.removeClass("fancytree-ext-filter")},n.ui.fancytree.registerExtension("filter",{options:{mode:"dimm"},treeInit:function(n){this._super(n),n.tree.filter=!1},treeDestroy:function(n){this._super(n)},nodeRenderStatus:function(t){var u,i=t.node,e=t.options,f=t.tree,r=n(i[f.statusClassPropName]);r.length&&(this._super(t),f.enableFilter)&&(i.match?r.addClass("fancytree-match"):r.removeClass("fancytree-match"),i.subMatch?r.addClass("fancytree-submatch"):r.removeClass("fancytree-submatch"),e.filter.mode==="hide"&&(u=!!(i.match||i.subMatch),i.debug(i.title+": visible="+u),n(i.li).toggle(u)))}})}(jQuery,window,document),function(n,t,i){"use strict";n.ui.fancytree.registerExtension("menu",{version:"1.0.0pre",options:{enable:!0,selector:null,position:{},create:n.noop,beforeOpen:n.noop,open:n.noop,focus:n.noop,select:n.noop,close:n.noop},treeInit:function(t){var r=t.options,i=t.tree;this._super(t),i.menu.data={tree:i,node:null,$menu:null,menuId:null},i.$container.delegate("span.fancytree-node","contextmenu",function(t){var r=n.ui.fancytree.getNode(t),u={node:r,tree:r.tree,originalEvent:t,options:i.options};return i.menu._openMenu(u),!1}),n(r.menu.selector).menu({create:function(t){i.menu.data.$menu=n(this).menu("widget");var u=n.extend({},i.menu.data);r.menu.create.call(i,t,u)},focus:function(t,u){var f=n.extend({},i.menu.data,{menuItem:u.item,menuId:u.item.find(">a").attr("href")});r.menu.focus.call(i,t,f)},select:function(u,f){var e=n.extend({},i.menu.data,{menuItem:f.item,menuId:f.item.find(">a").attr("href")});r.menu.select.call(i,u,e)!==!1&&i.menu._closeMenu(t)}}).hide()},treeDestroy:function(n){this._super(n)},_openMenu:function(t){var u,r=t.tree,f=t.options,e=n(f.menu.selector);(r.menu.data.node=t.node,u=n.extend({},r.menu.data),f.menu.beforeOpen.call(r,t.originalEvent,u)!==!1)&&(n(i).bind("keydown.fancytree",function(i){i.which===n.ui.keyCode.ESCAPE&&r.menu._closeMenu(t)}).bind("mousedown.fancytree",function(i){n(i.target).closest(".ui-menu-item").length===0&&r.menu._closeMenu(t)}),e.css("position","absolute").show().position({my:"left top",at:"right top",of:t.originalEvent,collision:"fit"}).focus(),f.menu.open.call(r,t.originalEvent,u))},_closeMenu:function(t){var u,r=t.tree,f=t.options,e=n.extend({},r.menu.data);f.menu.close.call(r,t.originalEvent,e)!==!1&&(u=n(f.menu.selector),n(i).unbind("keydown.fancytree, mousedown.fancytree"),u.hide(),r.menu.data.node=null)}})}(jQuery,window,document),function(n,t,i,r){"use strict";function s(t,i){i=i||"",t||n.error("Assertion failed "+i)}var e="active",u="expanded",o="focus",f="selected";n.ui.fancytree._FancytreeClass.prototype.clearCookies=function(t){var i=this.persist.cookiePrefix;t=t||"active expanded focus selected",t.indexOf(e)>=0&&n.cookie(i+e,null),t.indexOf(u)>=0&&n.cookie(i+u,null),t.indexOf(o)>=0&&n.cookie(i+o,null),t.indexOf(f)>=0&&n.cookie(i+f,null)},n.ui.fancytree.registerExtension("persist",{options:{cookieDelimiter:"~",cookiePrefix:r,cookie:{raw:!1,expires:"",path:"",domain:"",secure:!1},overrideSource:!1,types:"active expanded focus selected"},_setKey:function(t,i,r){var h=this.persist,f=this.options.persist,e=h.cookiePrefix+t,o=n.cookie(e),u=o?o.split(f.cookieDelimiter):[],s=n.inArray(i,u);s>=0&&u.splice(s,1),r&&u.push(i),n.cookie(e,u.join(f.cookieDelimiter),f.cookie)},treeInit:function(t){var l=t.tree,a=t.options,h=this.persist,c=this.options.persist;s(n.cookie,"Missing required plugin for 'persist' extension: jquery.cookie.js"),h.cookiePrefix=c.cookiePrefix||"fancytree-"+l._id+"-",h.storeActive=c.types.indexOf(e)>=0,h.storeExpanded=c.types.indexOf(u)>=0,h.storeSelected=c.types.indexOf(f)>=0,h.storeFocus=c.types.indexOf(o)>=0,l.$div.bind("fancytreeinit",function(){var v,y,s,p=n.cookie(h.cookiePrefix+o),t;if(l.debug("COOKIE "+i.cookie),h.storeExpanded&&(v=n.cookie(h.cookiePrefix+u),v))for(y=v.split(c.cookieDelimiter),s=0;s<y.length;s++)t=l.getNodeByKey(y[s]),t?(t.expanded===r||c.overrideSource&&t.expanded===!1)&&(t.expanded=!0,t.render()):h._setKey(u,y[s],!1);if(h.storeSelected&&(v=n.cookie(h.cookiePrefix+f),v))for(y=v.split(c.cookieDelimiter),s=0;s<y.length;s++)t=l.getNodeByKey(y[s]),t?(t.selected===r||c.overrideSource&&t.selected===!1)&&(t.selected=!0,t.renderStatus()):h._setKey(f,y[s],!1);h.storeActive&&(v=n.cookie(h.cookiePrefix+e),v&&(a.persist.overrideSource||!l.activeNode)&&(t=l.getNodeByKey(v),t&&t.setActive())),h.storeFocus&&p&&(t=l.getNodeByKey(p),t&&t.setFocus())}),this._super(t)},nodeSetActive:function(t,i){var r=this.persist,u=this.options.persist;this._super(t,i),r.storeActive&&n.cookie(r.cookiePrefix+e,this.activeNode?this.activeNode.key:null,u.cookie)},nodeSetExpanded:function(n,t){var r=n.node,i=this.persist;this._super(n,t),i.storeExpanded&&i._setKey(u,r.key,t)},nodeSetFocus:function(t){var i=this.persist,r=this.options.persist;this._super(t),i.storeFocus&&n.cookie(this.cookiePrefix+o,this.focusNode?this.focusNode.key:null,r.cookie)},nodeSetSelected:function(n,t){var r=n.node,i=this.persist;this._super(n,t),i.storeSelected&&i._setKey(f,r.key,t)}})}(jQuery,window,document),function(n,t,i){"use strict";function r(t,i){i=i||"",t||n.error("Assertion failed "+i)}function u(n,t){n.parentNode.insertBefore(t,n.nextSibling)}function f(n,t){n.visit(function(n){var i=n.tr;return i&&(i.style.display=t?"":"none"),n.expanded?void 0:"skip"})}function e(t){var o,f,i,e=t.parent,u=e?e.children:null;if(u&&u.length>1&&u[0]!==t)for(o=n.inArray(t,u),i=u[o-1],r(i.tr);i.children;){if(f=i.children[i.children.length-1],!f.tr)break;i=f}else i=e;return i}n.ui.fancytree.registerExtension("table",{options:{indentation:16,nodeColumnIdx:0,checkboxColumnIdx:null},treeInit:function(t){var f,u,e,r=t.tree,o=r.widget.element;for(o.addClass("fancytree-container fancytree-ext-table"),r.tbody=o.find("> tbody")[0],r.columnCount=n("thead >tr >th",o).length,n(r.tbody).empty(),r.rowFragment=i.createDocumentFragment(),u=n("<tr>"),e="",t.options.aria&&(u.attr("role","row"),e=" role='gridcell'"),f=0;f<r.columnCount;f++)t.options.table.nodeColumnIdx===f?u.append("<td"+e+"><span class='fancytree-node'><\/span><\/td>"):u.append("<td"+e+">");r.rowFragment.appendChild(u.get(0)),this._super(t),n(r.rootNode.ul).remove(),r.rootNode.ul=null,r.$container=o,r.$container.attr("tabindex","0"),this.options.aria&&r.$container.attr("role","treegrid").attr("aria-readonly",!0),r.statusClassPropName="tr",r.ariaPropName="tr"},nodeRemoveChildMarkup:function(t){var i=t.node;i.visit(function(t){t.tr&&(n(t.tr).remove(),t.tr=null)})},nodeRemoveMarkup:function(t){var i=t.node;i.tr&&(n(i.tr).remove(),i.tr=null),this.nodeRemoveChildMarkup(t)},nodeRender:function(t,i,f,o,s){var d,a,g,w,nt,c,v,y,b,l=t.tree,h=t.node,p=t.options,k=!h.parent;if(s||(t.hasCollapsedParents=h.parent&&!h.parent.expanded),k||h.tr||(c=l.rowFragment.firstChild.cloneNode(!0),v=e(h),r(v),o===!0&&s?c.style.display="none":f&&t.hasCollapsedParents&&(c.style.display="none"),v.tr?u(v.tr,c):(r(!v.parent,"prev. row must have a tr, or is system root"),l.tbody.appendChild(c)),h.tr=c,h.key&&p.generateIds&&(h.tr.id=p.idPrefix+h.key),h.tr.ftnode=h,p.aria&&n(h.tr).attr("aria-labelledby","ftal_"+h.key),h.span=n("span.fancytree-node",h.tr).get(0),this.nodeRenderTitle(t),p.checkbox&&p.table.checkboxColumnIdx!=null&&(d=n("span.fancytree-checkbox",h.span).detach(),n(h.tr).find("td:first").append(d)),l._triggerNodeEvent("createNode",t)),l._triggerNodeEvent("renderNode",t),a=h.children,a&&(k||f||h.expanded))for(w=0,nt=a.length;w<nt;w++)b=n.extend({},t,{node:a[w]}),b.hasCollapsedParents=b.hasCollapsedParents||!h.expanded,this.nodeRender(b,i,f,o,!0);a&&!s&&(y=h.tr||null,g=l.tbody.firstChild,h.visit(function(n){if(n.tr){if(h.expanded||k||n.tr.style.display==="none"||(n.tr.style.display="none"),n.tr.previousSibling!==y){h.debug("_fixOrder: mismatch at node: "+n);var t=y?y.nextSibling:g;l.tbody.insertBefore(n.tr,t)}y=n.tr}})),k||this.nodeRenderStatus(t)},nodeRenderTitle:function(n){var t=n.node;this._super(n),n.tree._triggerNodeEvent("renderColumns",t)},nodeRenderStatus:function(t){var i,r=t.node,u=t.options;this._super(t),i=(r.getLevel()-1)*u.table.indentation,i&&n(r.span).css({marginLeft:i+"px"})},nodeSetExpanded:function(t,i){var u=t.node,r=new n.Deferred;return this._super(t,i).done(function(){i=i!==!1,f(t.node,i),r.resolveWith(u)}),r},nodeSetStatus:function(t,i,r,u){if(i==="ok"){var e=t.node,f=e.children?e.children[0]:null;f&&f.isStatusNode&&n(f.tr).remove()}this._super(t,i,r,u)}})}(jQuery,window,document),function(n){"use strict";n.ui.fancytree.registerExtension("themeroller",{options:{activeClass:"ui-state-active",foccusClass:"ui-state-focus",hoverClass:"ui-state-hover",selectedClass:"ui-state-highlight"},treeInit:function(t){this._super(t);var i=t.widget.element;i[0].nodeName==="TABLE"?(i.addClass("ui-widget ui-corner-all"),i.find(">thead tr").addClass("ui-widget-header"),i.find(">tbody").addClass("ui-widget-conent")):i.addClass("ui-widget ui-widget-content ui-corner-all"),i.delegate(".fancytree-node","mouseenter mouseleave",function(t){var i=n.ui.fancytree.getNode(t.target),r=t.type==="mouseenter";i.debug("hover: "+r),n(i.span).toggleClass("ui-state-hover ui-corner-all",r)})},treeDestroy:function(n){this._super(n),n.widget.element.removeClass("ui-widget ui-widget-content ui-corner-all")},nodeRenderStatus:function(t){var i=t.node,r=n(i.span);this._super(t),r.toggleClass("ui-state-active",i.isActive()),r.toggleClass("ui-state-focus",i.hasFocus()),r.toggleClass("ui-state-highlight",i.isSelected())}})}(jQuery,window,document);
|
|
//@ sourceMappingURL=jQuery-Fancytree.min.js.map
|