Commit e64eb24c authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

runner: Merge -> add tabs and file upload (Alain T)

Merge branch 'slaprunner-layout' into slaprunner-paas
parents 52d190a8 5a60f8f1
.editor {
margin: 0;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.box_header{
background: #E4E4E4;
width: 100%;
height: 30px;
color: #737373;
border-bottom: 4px solid #7FAED3;
min-width: 936px;
}
.box_header ul{float: left; padding-top: 2px; text-shadow: 0px 1px #F1F1F1;}
.box_header li{float: left;border: 1px solid #AAB8C2;padding: 1px 5px 1px 0;margin-left: 5px; text-indent: 5px;}
/*.box_header li:last-child{border:none}*/
.box_header li > span{cursor: pointer; height: 20px; display: block;line-height: 20px;font-weight: bold;padding: 1px;}
.box_header li:hover{border: 1px solid #57A1D6;background-color: #C7C7C7;}
.box_header li:last-child{margin-right: 5px;}
.box_header li>a{font-weight: bold; font-size:1em;display: block;padding: 2px;}
.save_btn{background: url(../images/icon_save.png) center right no-repeat;width: 25px;}
.expand_editor{background: url(../images/fullscreen.png) center right no-repeat;width: 23px;}
.e_expanded{background: url(../images/fullscreen_exit.png) center right no-repeat;}
.swith_btn{background: url(../images/gnome-session-switch.png) center right no-repeat;width: 105px;}
.flist_btn{background: url(../images/list2_down.png) center right no-repeat;width: 26px;}
.fmenu_btn{background: url(../images/ui_menu_blue.png) center right no-repeat;width: 58px;}
#tabControl{overflow: hidden;}
#tabControl .item{float:left; min-width: 60px; background: #D5D5D5; height: 22px; padding-top: 8px; font-size:1em;
border-left:1px #E4E4E4 solid; cursor:pointer; color: #5C7077; text-shadow: 0px 1px #E6E6E6; position: relative;}
#tabControl .item:hover{background: #C7C7C7;}
#tabControl.item:last-child{margin-right:none; overflow: hidden}
#tabControl .active{background: #7FAED3; color: #fff; text-shadow: none;}
#tabControl .active:hover{background: #7FAED3;}
#tabControl .item span{padding: 0 4px; display: block; float: left; text-overflow:clip; max-width: 126px; white-space:nowrap; overflow: hidden;}
#tabControl .active span.bt_close{color: #DBDBDB;}
#tabControl .active span.bt_close:hover{color: #fff;}
#tabContent pre {display: none;}
#tabContent pre.active {display: block;}
.item-hide{display:none;}
......@@ -69,3 +69,4 @@
.contextMenu LI.md5sum A { background-image: url(images/selection-select.png); }
.contextMenu LI.refresh A { background-image: url(images/refresh.png); }
.contextMenu LI.favorite A { background-image: url(images/knewstuff.png); }
.contextMenu LI.uploadfile A { background-image: url(images/upload_folder.png); }
\ No newline at end of file
......@@ -8,7 +8,7 @@ img{border:0}
/*YAHOO RESET FONT*/
html{color:#000;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,select,p,blockquote,th,td{margin:0;padding:0}table{border-collapse:collapse;border-spacing:0}fieldset,img{border:0}address,button,caption,cite,code,dfn,em,input,optgroup,option,select,strong,textarea,th,var{font:inherit}del,ins{text-decoration:none}li{list-style:none}caption,th{text-align:left}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}q:before,q:after{content:''}abbr,acronym{border:0;font-variant:normal}sup{vertical-align:baseline}sub{vertical-align:baseline}legend{color:#000}body{font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small}select,input,textarea,button{font:99% arial,helvetica,clean,sans-serif}table{font-size:inherit;font:100%}pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%}
body{
background: #A2BDC5;
background: #8DABB4;/* #A2BDC5;*/
height:100%;
}
......@@ -125,15 +125,6 @@ body {
margin-left:5px
}
#editor, #editorViewer {
margin: 0;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
#wmenu{
margin: 1px 11px 1px 10px;
}
......@@ -164,7 +155,7 @@ body {
}
.main_head{
height: 15px;
height: 14px;
background: url(../images/main_top.png) no-repeat;
width: 966px;
}
......@@ -419,7 +410,7 @@ padding: 10px;height: 80px;padding-bottom:15px;}
}
#code{
float: right;
width: 680px;
width: 692px;
}
#details_head{margin-bottom: 10px;}
......@@ -555,12 +546,10 @@ padding: 10px;height: 80px;padding-bottom:15px;}
}
.file_info{
margin-top:10px;
margin-top:5px;
background: #e4e4e4;
padding: 5px 10px 5px;
box-shadow: 1px 1px 1px #888888;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
color: #737373;
font-weight: bold;
text-shadow: 0px 1px #FFF;
......@@ -600,7 +589,6 @@ label.header {
font-weight: normal;
}
select {
-webkit-appearance: button;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1);
......@@ -644,26 +632,15 @@ a.no-right-border:focus{border-right:none}
a.lshare img{
margin: 5px;
}
.box_header{
background: #E4E4E4;
width: 100%;
height: 30px;
padding-top: 2px;
text-indent: 5px;
color: #737373;
text-shadow: 0px 1px #F1F1F1;
border-bottom: 3px solid #6DB9DD;
}
.box_header li{float: left;border: 1px solid #AAB8C2;padding: 1px 5px 1px 0;margin-left: 5px;}
.box_header li:last-child{border:none}
.box_header li > span{cursor: pointer; height: 22px; display: block;line-height: 22px;font-weight: bold;padding: 1px;}
.box_header li:hover{border: 1px solid #57A1D6;background: #C7C7C7;}
.box_header li:last-child:hover{background:none; border: none}
.box_header li>a{font-weight: bold; font-size:15px;display: block;padding: 2px;}
.save_btn{background: url(../images/icon_save.png) center right no-repeat;width: 60px;}
.swith_btn{background: url(../images/gnome-session-switch.png) center right no-repeat;width: 105px;}
.flist_btn{background: url(../images/list2_down.png) center right no-repeat;width: 26px;}
.fmenu_btn{background: url(../images/ui_menu_blue.png) center right no-repeat;width: 58px;}
#editor, #editorViewer {
margin: 0;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
#error{
padding: 0px;
......@@ -794,11 +771,17 @@ padding:10px; font-size:14px; color:#03406A}
.information{display:block; float:left; height:16px; margin-top:10px; margin-left:10px; font-weight:bold}
.account{margin-left:60px;}
/*-------------------------ACE UPDATE------------------------*/
.ace_search{
width: 350px;
max-width: 350px;
}
.bt_close {
text-decoration: none;
color: #999;
font-weight: bold;
font-size: 16px;
font-size: 1em;
padding: 0 4px;
-webkit-border-radius: .2em;
-moz-border-radius: .2em;
......@@ -806,17 +789,11 @@ padding:10px; font-size:14px; color:#03406A}
cursor: pointer;
}
.bt_close:hover {
background: #D6D6D6;
color: #333;
}
/*-------------------------ACE UPDATE------------------------*/
.ace_search{
width: 350px;
max-width: 350px;
}
.fullScreen .fullScreen-editor{
.fullScreen{
background: #fff;
height: auto!important;
width: auto!important;
border: 0;
......@@ -826,7 +803,26 @@ padding:10px; font-size:14px; color:#03406A}
bottom: 0;
left: 0;
right: 0;
z-index: 10000;
z-index: 140;
}
.fullScreen-editor{
height: auto!important;
width: auto!important;
position: fixed !important;
top: 35px;
bottom: 0;
left: 244px;
right: 0;
}
.fullScreen-tree{
height: auto!important;
width: 238px;
position: fixed !important;
top: 37px;
bottom: 0;
left: 0;
right: 0;
}
.fullScreen {
......
/*! jQuery Fancytree Plugin - v2.0.0-4 - 2013-10-14 21:10
/*! jQuery Fancytree Plugin - 2.0.0-9 - 2014-04-02 22:04
* https://github.com/mar10/fancytree
* Copyright (c) 2013 Martin Wendt; Licensed MIT */
!function(a,b,c,d){"use strict";function e(b){b=b||"",a.error("Not implemented: "+b)}function f(b,c){c=": "+c||"",b||a.error("Assertion failed"+c)}function g(a,c){var d,e,f=b.console?b.console[a]:null;if(f)if(f.apply)f.apply(b.console,c);else{for(e="",d=0;d<c.length;d++)e+=c[d];f(e)}}function h(b){var c,d,e,f=a.map(a.trim(b).split("."),function(a){return parseInt(a,10)}),g=a.map(Array.prototype.slice.call(arguments,1),function(a){return parseInt(a,10)});for(c=0;c<g.length;c++)if(d=f[c]||0,e=g[c]||0,d!==e)return d>e;return!0}function i(a,b,c,d,e){var f=function(){var c=b[a],f=d[a],g=b.ext[e],h=function(){return c.apply(b,arguments)};return function(){var a=b._local,c=b._super;try{return b._local=g,b._super=h,f.apply(b,arguments)}finally{b._local=a,b._super=c}}}();return f}function j(b,c,d,e){for(var f in d)"function"==typeof d[f]?"function"==typeof b[f]?b[f]=i(f,b,c,d,e):"_"===f.charAt(0)?b.ext[e][f]=i(f,b,c,d,e):a.error("Could not override tree."+f+". Use prefix '_' to create tree."+e+"._"+f):"options"!==f&&(b.ext[e][f]=d[f])}function k(b,c){return b===d?a.Deferred(function(){this.resolve()}).promise():a.Deferred(function(){this.resolveWith(b,c)}).promise()}function l(b,c){return b===d?a.Deferred(function(){this.reject()}).promise():a.Deferred(function(){this.rejectWith(b,c)}).promise()}function m(a,b){return function(){a.resolveWith(b)}}function n(a){return a=a.toLowerCase(),function(b){return b.title.toLowerCase().indexOf(a)>=0}}function o(b,c){var d,e,g,h;for(this.parent=b,this.tree=b.tree,this.ul=null,this.li=null,this.isStatusNode=!1,this.data={},d=0,e=u.length;e>d;d++)g=u[d],this[g]=c[g];c.data&&a.extend(this.data,c.data);for(g in c)v[g]||a.isFunction(c[g])||w[g]||(this.data[g]=c[g]);null==this.key&&(this.key="_"+r._nextNodeKey++),c.active&&(f(null===this.tree.activeNode,"only one active node allowed"),this.tree.activeNode=this),this.children=null,h=c.children,h&&h.length&&this._setChildren(h)}function p(b){this.widget=b,this.$div=b.element,this.options=b.options,this.ext={},this._id=a.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 c,d={tree:this};this.rootNode=new o(d,{title:"root",key:"root_"+this._id,children:null}),this.rootNode.parent=null,c=a("<ul>",{"class":"ui-fancytree fancytree-container"}).appendTo(this.$div),this.$container=c,this.rootNode.ul=c[0],null==this.options.debugLevel&&(this.options.debugLevel=r.debugLevel),this.options.tabbable&&this.$container.attr("tabindex","0"),this.options.aria&&this.$container.attr("role","tree").attr("aria-multiselectable",!0)}if(a.ui.fancytree&&a.ui.fancytree.version)return a.ui.fancytree.warn("Fancytree: ignored duplicate include"),void 0;var q,r=null,s="active expanded focus folder lazy selected unselectable".split(" "),t={},u="expanded extraClasses folder hideCheckbox key lazy selected title tooltip unselectable".split(" "),v={},w={active:!0,children:!0,data:!0,focus:!0};for(q=0;q<s.length;q++)t[s[q]]=!0;for(q=0;q<u.length;q++)v[u[q]]=!0;o.prototype={_findDirectChild:function(a){var b,c,d=this.children;if(d)if("string"==typeof a){for(b=0,c=d.length;c>b;b++)if(d[b].key===a)return d[b]}else{if("number"==typeof a)return this.children[a];if(a.parent===this)return a}return null},_setChildren:function(a){f(a&&(!this.children||0===this.children.length),"only init supported"),this.children=[];for(var b=0,c=a.length;c>b;b++)this.children.push(new o(this,a[b]))},addChildren:function(b,c){var d,e,g,h=null,i=[];for(a.isPlainObject(b)&&(b=[b]),this.children||(this.children=[]),d=0,e=b.length;e>d;d++)i.push(new o(this,b[d]));return h=i[0],null==c?this.children=this.children.concat(i):(c=this._findDirectChild(c),g=a.inArray(c,this.children),f(g>=0,"insertBefore must be an existing child"),this.children.splice.apply(this.children,[g,0].concat(i))),(!this.parent||this.parent.ul)&&this.render(),3===this.tree.options.selectMode&&this.fixSelection3FromEndNodes(),h},addNode:function(a,b){switch((b===d||"over"===b)&&(b="child"),b){case"after":return this.getParent().addChildren(a,this.getNextSibling());case"before":return this.getParent().addChildren(a,this);case"child":case"over":return this.addChildren(a)}f(!1,"Invalid mode: "+b)},applyPatch:function(b){if(null===b)return this.remove(),k(this);var c,d,e,f={children:!0,expanded:!0,parent:!0};for(c in b)e=b[c],f[c]||a.isFunction(e)||(v[c]?this[c]=e:this.data[c]=e);return b.hasOwnProperty("children")&&(this.removeChildren(),b.children&&this._setChildren(b.children)),this.isVisible()&&(this.renderTitle(),this.renderStatus()),d=b.hasOwnProperty("expanded")?this.setExpanded(b.expanded):k(this)},collapseSiblings:function(){return this.tree._callHook("nodeCollapseSiblings",this)},copyTo:function(a,b,c){return a.addNode(this.toDict(!0,c),b)},countChildren:function(a){var b,c,d,e=this.children;if(!e)return 0;if(d=e.length,a!==!1)for(b=0,c=d;c>b;b++)d+=e[b].countChildren();return d},debug:function(){this.tree.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),g("debug",arguments))},discard:function(){return this.lazy&&a.isArray(this.children)?(this.removeChildren(),this.setExpanded(!1)):void 0},findAll:function(b){b=a.isFunction(b)?b:n(b);var c=[];return this.visit(function(a){b(a)&&c.push(a)}),c},findFirst:function(b){b=a.isFunction(b)?b:n(b);var c=null;return this.visit(function(a){return b(a)?(c=a,!1):void 0}),c},_changeSelectStatusAttrs:function(a){var b=!1;switch(a){case!1:b=this.selected||this.partsel,this.selected=!1,this.partsel=!1;break;case!0:b=!this.selected||!this.partsel,this.selected=!0,this.partsel=!0;break;case d:b=this.selected||!this.partsel,this.selected=!1,this.partsel=!0;break;default:f(!1,"invalid state: "+a)}return this.debug("fixSelection3AfterLoad() _changeSelectStatusAttrs()",a,b),b&&this.renderStatus(),b},fixSelection3AfterClick:function(){var a=this.isSelected();this.visit(function(b){b._changeSelectStatusAttrs(a)}),this.fixSelection3FromEndNodes()},fixSelection3FromEndNodes:function(){function a(b){var c,e,f,g,h,i,j,k=b.children;if(k){for(i=!0,j=!1,c=0,e=k.length;e>c;c++)f=k[c],g=a(f),g!==!1&&(j=!0),g!==!0&&(i=!1);h=i?!0:j?d:!1}else h=!!b.selected;return b._changeSelectStatusAttrs(h),h}f(3===this.tree.options.selectMode,"expected selectMode 3"),a(this),this.visitParents(function(a){var b,c,e,f,g=a.children,h=!0,i=!1;for(b=0,c=g.length;c>b;b++)e=g[b],(e.selected||e.partsel)&&(i=!0),e.unselectable||e.selected||(h=!1);f=h?!0:i?d:!1,a._changeSelectStatusAttrs(f)})},fromDict:function(b){for(var c in b)v[c]?this[c]=b[c]:"data"===c?a.extend(this.data,b.data):a.isFunction(b[c])||w[c]||(this.data[c]=b[c]);b.children?(this.removeChildren(),this.addChildren(b.children)):this.renderTitle()},getChildren:function(){return this.hasChildren()===d?d:this.children},getFirstChild:function(){return this.children?this.children[0]:null},getIndex:function(){return a.inArray(this,this.parent.children)},getIndexHier:function(b){b=b||".";var c=[];return a.each(this.getParentList(!1,!0),function(a,b){c.push(b.getIndex()+1)}),c.join(b)},getKeyPath:function(a){var b=[],c=this.tree.options.keyPathSeparator;return this.visitParents(function(a){a.parent&&b.unshift(a.key)},!a),c+b.join(c)},getLastChild:function(){return this.children?this.children[this.children.length-1]:null},getLevel:function(){for(var a=0,b=this.parent;b;)a++,b=b.parent;return a},getNextSibling:function(){if(this.parent){var a,b,c=this.parent.children;for(a=0,b=c.length-1;b>a;a++)if(c[a]===this)return c[a+1]}return null},getParent:function(){return this.parent},getParentList:function(a,b){for(var c=[],d=b?this:this.parent;d;)(a||d.parent)&&c.unshift(d),d=d.parent;return c},getPrevSibling:function(){if(this.parent){var a,b,c=this.parent.children;for(a=1,b=c.length;b>a;a++)if(c[a]===this)return c[a-1]}return null},hasChildren:function(){return this.lazy?null===this.children||this.children===d?d:0===this.children.length?!1:1===this.children.length&&this.children[0].isStatusNode?d:!0:!!this.children},hasFocus:function(){return this.tree.hasFocus()&&this.tree.focusNode===this},isActive:function(){return this.tree.activeNode===this},isChildOf:function(a){return this.parent&&this.parent===a},isDescendantOf:function(a){if(!a||a.tree!==this.tree)return!1;for(var b=this.parent;b;){if(b===a)return!0;b=b.parent}return!1},isExpanded:function(){return!!this.expanded},isFirstSibling:function(){var a=this.parent;return!a||a.children[0]===this},isFolder:function(){return!!this.folder},isLastSibling:function(){var a=this.parent;return!a||a.children[a.children.length-1]===this},isLazy:function(){return!!this.lazy},isLoading:function(){e()},isRoot:function(){return this.tree.rootNode===this},isSelected:function(){return!!this.selected},isVisible:function(){var a,b,c=this.getParentList(!1,!1);for(a=0,b=c.length;b>a;a++)if(!c[a].expanded)return!1;return!0},makeVisible:function(){var a,b,c=this.getParentList(!1,!1);for(a=0,b=c.length;b>a;a++)c[a].setExpanded(!0)},moveTo:function(b,c,e){(c===d||"over"===c)&&(c="child");var g,h=this.parent,i="child"===c?b:b.parent;if(this!==b){if(!this.parent)throw"Cannot move system root";if(i.isDescendantOf(this))throw"Cannot move a node to it's own descendant";if(1===this.parent.children.length?(this.parent.children=this.parent.lazy?[]:null,this.parent.expanded=!1):(g=a.inArray(this,this.parent.children),f(g>=0),this.parent.children.splice(g,1)),this.parent=i,i.hasChildren())switch(c){case"child":i.children.push(this);break;case"before":g=a.inArray(b,i.children),f(g>=0),i.children.splice(g,0,this);break;case"after":g=a.inArray(b,i.children),f(g>=0),i.children.splice(g+1,0,this);break;default:throw"Invalid mode "+c}else i.children=[this];e&&b.visit(e,!0),this.tree!==b.tree&&(this.warn("Cross-tree moveTo is experimantal!"),this.visit(function(a){a.tree=b.tree},!0)),i.expanded||h.ul.removeChild(this.li),h.isDescendantOf(i)||h.render(),i.isDescendantOf(h)||i===h||i.render()}},lazyLoad:function(b){b?this.discard():f(!a.isArray(this.children));var c=this.tree._triggerNodeEvent("lazyload",this);return f("boolean"!=typeof c,"lazyload event must return source in data.result"),this.tree._callHook("nodeLoadChildren",this,c)},render:function(a,b){return this.tree._callHook("nodeRender",this,a,b)},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(a){return this.tree._callHook("nodeRemoveChild",this,a)},removeChildren:function(){return this.tree._callHook("nodeRemoveChildren",this)},scheduleAction:function(a,b){this.tree.timer&&clearTimeout(this.tree.timer),this.tree.timer=null;var c=this;switch(a){case"cancel":break;case"expand":this.tree.timer=setTimeout(function(){c.tree.debug("setTimeout: trigger expand"),c.setExpanded(!0)},b);break;case"activate":this.tree.timer=setTimeout(function(){c.tree.debug("setTimeout: trigger activate"),c.setActive(!0)},b);break;default:throw"Invalid mode "+a}},scrollIntoView:function(b,c){b=b===!0?{duration:200,queue:!1}:b;var d,e=new a.Deferred,f=a(this.span).position().top,g=a(this.span).height(),h=this.tree.$container,i=h[0].scrollTop,j=Math.max(0,h.innerHeight()-h[0].clientHeight),k=h.height()-j,l=null;return 0>f?l=i+f:f+g>k&&(l=i+f-k+g,c&&(d=c?a(c.span).position().top:0,f-d>k&&(l=i+f))),null!==l?b?h.animate({scrollTop:l},b):(h[0].scrollTop=l,e.resolveWith(this)):e.resolveWith(this),e.promise()},setActive:function(a){return this.tree._callHook("nodeSetActive",this,a)},setExpanded:function(a){return this.tree._callHook("nodeSetExpanded",this,a)},setFocus:function(a){return this.tree._callHook("nodeSetFocus",this,a)},setSelected:function(a){return this.tree._callHook("nodeSetSelected",this,a)},setTitle:function(a){this.title=a,this.renderTitle()},sortChildren:function(a,b){var c,d,e=this.children;if(e){if(a=a||function(a,b){var c=a.title.toLowerCase(),d=b.title.toLowerCase();return c===d?0:c>d?1:-1},e.sort(a),b)for(c=0,d=e.length;d>c;c++)e[c].children&&e[c].sortChildren(a,"$norender$");"$norender$"!==b&&this.render()}},toDict:function(b,c){var d,e,f,g={},h=this;if(a.each(u,function(a,b){(h[b]||h[b]===!1)&&(g[b]=h[b])}),a.isEmptyObject(this.data)||(g.data=a.extend({},this.data),a.isEmptyObject(g.data)&&delete g.data),c&&c(g),b&&this.hasChildren())for(g.children=[],d=0,e=this.children.length;e>d;d++)f=this.children[d],f.isStatusNode||g.children.push(f.toDict(!0,c));return g},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(a,b){var c,d,e=!0,f=this.children;if(b===!0&&(e=a(this),e===!1||"skip"===e))return e;if(f)for(c=0,d=f.length;d>c&&(e=f[c].visit(a,!0),e!==!1);c++);return e},visitParents:function(a,b){if(b&&a(this)===!1)return!1;for(var c=this.parent;c;){if(a(c)===!1)return!1;c=c.parent}return!0},warn:function(){Array.prototype.unshift.call(arguments,this.toString()),g("warn",arguments)}},p.prototype={_makeHookContext:function(b,c){if(b.node!==d)return c&&b.originalEvent!==c&&a.error("invalid args"),b;if(b.tree){var e=b.tree;return{node:b,tree:e,widget:e.widget,options:e.widget.options,originalEvent:c}}return b.widget?{node:null,tree:b,widget:b.widget,options:b.widget.options,originalEvent:c}:(a.error("invalid args"),void 0)},_callHook:function(b,c){var d=this._makeHookContext(c),e=this[b],f=Array.prototype.slice.call(arguments,2);return a.isFunction(e)||a.error("_callHook('"+b+"') is not a function"),f.unshift(d),e.apply(this,f)},activateKey:function(a){var b=this.getNodeByKey(a);return b?b.setActive():this.activeNode&&this.activeNode.setActive(!1),b},applyPatch:function(b){var c,d,e,g,h,i,j=b.length,k=[];for(d=0;j>d;d++)e=b[d],f(2===e.length,"patchList must be an array of length-2-arrays"),g=e[0],h=e[1],i=null===g?this.rootNode:this.getNodeByKey(g),i?(c=new a.Deferred,k.push(c),i.applyPatch(h).always(m(c,i))):this.warn("could not find node with key '"+g+"'");return a.when.apply(a,k).promise()},count:function(){return this.rootNode.countChildren()},debug:function(){this.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),g("debug",arguments))},generateFormElements:function(b,c){var d,e=b!==!1?"ft_"+this._id:b,f=c!==!1?"ft_"+this._id+"_active":c,g="fancytree_result_"+this._id,h=this.$container.find("div#"+g);h.length?h.empty():h=a("<div>",{id:g}).hide().appendTo(this.$container),e&&(d=this.getSelectedNodes(3===this.options.selectMode),a.each(d,function(b,c){h.append(a("<input>",{type:"checkbox",name:e,value:c.key,checked:!0}))})),f&&this.activeNode&&h.append(a("<input>",{type:"radio",name:f,value:this.activeNode.key,checked:!0}))},getActiveNode:function(){return this.activeNode},getFirstChild:function(){return this.rootNode.getFirstChild()},getFocusNode:function(){return this.focusNode},getNodeByKey:function(a,b){var d,e;return!b&&(d=c.getElementById(this.options.idPrefix+a))?d.ftnode?d.ftnode:null:(b=b||this.rootNode,e=null,b.visit(function(b){return b.key===a?(e=b,!1):void 0},!0),e)},getSelectedNodes:function(a){var b=[];return this.rootNode.visit(function(c){return c.selected&&(b.push(c),a===!0)?"skip":void 0}),b},hasFocus:function(){return r.focusTree===this},info:function(){this.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),g("info",arguments))},loadKeyPath:function(b,c,e){function f(a,b,d){c.call(r,b,"loading"),b.lazyLoad().done(function(){r.loadKeyPath.call(r,l[a],c,b).always(m(d,r))}).fail(function(){r.warn("loadKeyPath: error loading: "+a+" (parent: "+p+")"),c.call(r,b,"error"),d.reject()})}var g,h,i,j,k,l,n,o,p=e||this.rootNode,q=this.options.keyPathSeparator,r=this;for(a.isArray(b)||(b=[b]),l={},i=0;i<b.length;i++)for(j=b[i],j.charAt(0)===q&&(j=j.substr(1)),o=j.split(q);o.length;){if(k=o.shift(),n=p._findDirectChild(k),!n){this.warn("loadKeyPath: key not found: "+k+" (parent: "+p+")"),c.call(this,k,"error");break}if(0===o.length){c.call(this,n,"ok");break}if(n.lazy&&n.hasChildren()===d){c.call(this,n,"loaded"),l[k]?l[k].push(o.join(q)):l[k]=[o.join(q)];break}c.call(this,n,"loaded"),p=n}g=[];for(k in l)n=p._findDirectChild(k),h=new a.Deferred,g.push(h),f(k,n,h);return a.when.apply(a,g).promise()},nodeClick:function(a){var b,c,d=a.originalEvent,e=a.targetType,f=a.node;if("expander"===e)this._callHook("nodeToggleExpanded",a);else if("checkbox"===e)this._callHook("nodeToggleSelected",a),this._callHook("nodeSetFocus",a,!0);else{if(c=!1,b=!0,f.folder)switch(a.options.clickFolderMode){case 2:c=!0,b=!1;break;case 3:b=!0,c=!0}b&&(this.nodeSetFocus(a),this._callHook("nodeSetActive",a,!0)),c&&this._callHook("nodeToggleExpanded",a)}"a"===d.target.localName&&"fancytree-title"===d.target.className&&d.preventDefault()},nodeCollapseSiblings:function(a){var b,c,d,e=a.node;if(e.parent)for(b=e.parent.children,c=0,d=b.length;d>c;c++)b[c]!==e&&b[c].expanded&&this._callHook("nodeSetExpanded",b[c],!1)},nodeDblclick:function(a){"title"===a.targetType&&4===a.options.clickFolderMode&&this._callHook("nodeToggleExpanded",a),"title"===a.targetType&&a.originalEvent.preventDefault()},nodeKeydown:function(b){function c(a){return a?(a.makeVisible(),f.ctrlKey||!i.autoActivate?a.setFocus():a.setActive()):void 0}var d,e,f=b.originalEvent,g=b.node,h=b.tree,i=b.options,j=!0,k=a.ui.keyCode,l=null;switch(g||(this.rootNode.getFirstChild().setFocus(),g=b.node=this.focusNode,g.debug("Keydown force focus on first node")),f.which){case k.NUMPAD_ADD:case 187:h.nodeSetExpanded(b,!0);break;case k.NUMPAD_SUBTRACT:case 189:h.nodeSetExpanded(b,!1);break;case k.SPACE:i.checkbox?h.nodeToggleSelected(b):h.nodeSetActive(b,!0);break;case k.ENTER:h.nodeSetActive(b,!0);break;case k.BACKSPACE:c(g.parent);break;case k.LEFT:g.expanded?(h.nodeSetExpanded(b,!1),c(g)):g.parent&&g.parent.parent&&c(g.parent);break;case k.RIGHT:g.expanded||!g.children&&!g.lazy?g.children&&c(g.children[0]):(h.nodeSetExpanded(b,!0),c(g));break;case k.UP:for(l=g.getPrevSibling();l&&l.expanded&&l.children;)l=l.children[l.children.length-1];!l&&g.parent&&g.parent.parent&&(l=g.parent),c(l);break;case k.DOWN:if(g.expanded&&g.children)l=g.children[0];else for(e=g.getParentList(!1,!0),d=e.length-1;d>=0&&!(l=e[d].getNextSibling());d--);c(l);break;default:j=!1}j&&f.preventDefault()},nodeLoadChildren:function(b,c){var d,e,g,h,i=b.tree,j=b.node,k=this;if(a.isFunction(c)&&(c=c()),c.url||a.isFunction(c.done)){if(i.nodeSetStatus(b,"loading"),c.url){if(d=a.extend({},b.options.ajax,c),d.debugLazyDelay)return g=d.debugLazyDelay,a.isArray(g)&&(g=g[0]+Math.random()*(g[1]-g[0])),j.debug("nodeLoadChildren waiting debug delay "+Math.round(g)+"ms"),h=a.Deferred(),setTimeout(function(){d.debugLazyDelay=!1,k.nodeLoadChildren(b,d).complete(function(){h.resolve.apply(this,arguments)})},g),h;h=a.ajax(d)}else h=c;h.done(function(c){var d;i.nodeSetStatus(b,"ok"),"string"==typeof c&&a.error("Ajax request returned a string (did you get the JSON dataType wrong?)."),b.options.postProcess?(d=i._triggerNodeEvent("postProcess",b,b.originalEvent,{response:c,dataType:this.dataType}),c=a.isArray(d)?d:c):c&&c.hasOwnProperty("d")&&b.options.enableAspx&&(c="string"==typeof c.d?a.parseJSON(c.d):c.d),e=c}).fail(function(a,c,d){i.nodeSetStatus(b,"error",c,a.status+": "+d),alert("error: "+c+" ("+a.status+": "+(d.message||d)+")")})}else h=a.Deferred(),e=c,h.resolve();return h.done(function(){f(a.isArray(e),"expected array of children"),j._setChildren(e),j.parent&&(j.isVisible()&&i.nodeRender(b),i._triggerNodeEvent("loadChildren",j))}).fail(function(){i.nodeRender(b)}),h},nodeLoadKeyPath:function(){},nodeMakeVisible:function(a){var b,c,d=a.node.getParentList(!1,!1);for(b=0,c=d.length;c>b;b++)d[b].setExpanded(!0)},nodeRemoveChild:function(b,c){var d,e=b.node,g=b.options,h=a.extend({},b,{node:c}),i=e.children;return r.debug("nodeRemoveChild()",e.toString(),c.toString()),1===i.length?(f(c===i[0]),this.nodeRemoveChildren(b)):(this.activeNode&&(c===this.activeNode||this.activeNode.isDescendantOf(c))&&this.activeNode.setActive(!1),this.focusNode&&(c===this.focusNode||this.focusNode.isDescendantOf(c))&&(this.focusNode=null),this.nodeRemoveMarkup(h),this.nodeRemoveChildren(h),d=a.inArray(c,i),f(d>=0),c.visit(function(a){a.parent=null},!0),g.removeNode&&g.removeNode.call(b.tree,{type:"removeNode"},h),i.splice(d,1),void 0)},nodeRemoveChildMarkup:function(b){var c=b.node;r.debug("nodeRemoveChildMarkup()",c.toString()),c.ul&&(a(c.ul).remove(),c.visit(function(a){a.li=a.ul=null}),c.ul=null)},nodeRemoveChildren:function(b){var c,e=b.node,f=e.children,g=b.options;r.debug("nodeRemoveChildren()",e.toString()),f&&(this.activeNode&&this.activeNode.isDescendantOf(e)&&this.activeNode.setActive(!1),this.focusNode&&this.focusNode.isDescendantOf(e)&&(this.focusNode=null),this.nodeRemoveChildMarkup(b),c=a.extend({},b),e.visit(function(a){a.parent=null,g.removeNode&&(c.node=a,g.removeNode.call(b.tree,{type:"removeNode"},c))}),e.children=d,this.nodeRenderStatus(b))},nodeRemoveMarkup:function(b){var c=b.node;r.debug("nodeRemoveMarkup()",c.toString()),c.li&&(a(c.li).remove(),c.li=null),this.nodeRemoveChildMarkup(b)},nodeRender:function(b,d,e,g,h){var i,j,k,l,m,n,o=b.node,p=b.tree,q=b.options,r=q.aria,s=!1,t=o.parent,u=!t,v=o.children;if(f(u||t.ul,"parent UL must exist"),u||(o.li&&(d||o.li.parentNode!==o.parent.ul)&&(o.li.parentNode!==o.parent.ul&&this.warn("unlink "+o+" (must be child of "+o.parent+")"),this.nodeRemoveMarkup(b)),o.li||(s=!0,o.li=c.createElement("li"),o.li.ftnode=o,o.key&&q.generateIds&&(o.li.id=q.idPrefix+o.key),o.span=c.createElement("span"),o.span.className="fancytree-node",r&&a(o.span).attr("aria-labelledby","ftal_"+o.key),o.li.appendChild(o.span),this.nodeRenderTitle(b),q.createNode&&q.createNode.call(p,{type:"createNode"},b)),q.renderNode&&q.renderNode.call(p,{type:"renderNode"},b)),v){if(u||o.expanded||e===!0){for(o.ul||(o.ul=c.createElement("ul"),(g===!0&&!h||!o.expanded)&&(o.ul.style.display="none"),r&&a(o.ul).attr("role","group"),o.li.appendChild(o.ul)),l=0,m=v.length;m>l;l++)n=a.extend({},b,{node:v[l]}),this.nodeRender(n,d,e,!1,!0);for(i=o.ul.firstChild,l=0,m=v.length-1;m>l;l++)j=v[l],k=i.ftnode,j!==k?(o.debug("_fixOrder: mismatch at index "+l+": "+j+" != "+k),o.ul.insertBefore(j.li,k.li)):i=i.nextSibling}}else o.ul&&(this.warn("remove child markup for "+o),this.nodeRemoveChildMarkup(b));u||(this.nodeRenderStatus(b),s&&t.ul.appendChild(o.li))},nodeRenderTitle:function(a,b){var c,e,f,g,h,i=a.node,j=a.tree,k=a.options,l=k.aria,m=i.getLevel(),n=[],o=i.data.icon;b!==d&&(i.title=b),i.span&&(m<k.minExpandLevel?m>1&&(l?n.push("<span role='button' class='fancytree-expander'></span>"):n.push("<span class='fancytree-expander'></span>")):l?n.push("<span role='button' class='fancytree-expander'></span>"):n.push("<span class='fancytree-expander'></span>"),k.checkbox&&i.hideCheckbox!==!0&&!i.isStatusNode&&(l?n.push("<span role='checkbox' class='fancytree-checkbox'></span>"):n.push("<span class='fancytree-checkbox'></span>")),g=l?" role='img'":"",o&&"string"==typeof o?(e="/"===o.charAt(0)?o:k.imagePath+o,n.push("<img src='"+e+"' alt='' />")):i.data.iconclass?n.push("<span "+g+" class='fancytree-custom-icon"+" "+i.data.iconclass+"'></span>"):(o===!0||o!==!1&&k.icons!==!1)&&n.push("<span "+g+" class='fancytree-icon'></span>"),f="",k.renderTitle&&(f=k.renderTitle.call(j,{type:"renderTitle"},a)||""),f||(h=i.tooltip?" title='"+i.tooltip.replace(/\"/g,"&quot;")+"'":"",c=l?" id='ftal_"+i.key+"'":"",g=l?" role='treeitem'":"",f="<span "+g+" class='fancytree-title'"+c+h+">"+i.title+"</span>"),n.push(f),i.span.innerHTML=n.join(""))},nodeRenderStatus:function(b){var c=b.node,d=b.tree,e=b.options,f=c.hasChildren(),g=c.isLastSibling(),h=e.aria,i=a(c.span).find(".fancytree-title"),j=e._classNames,k=[],l=c[d.statusClassPropName];l&&(k.push(j.node),d.activeNode===c&&k.push(j.active),d.focusNode===c?(k.push(j.focused),h&&i.attr("aria-activedescendant",!0)):h&&i.removeAttr("aria-activedescendant"),c.expanded?(k.push(j.expanded),h&&i.attr("aria-expanded",!0)):h&&i.removeAttr("aria-expanded"),c.folder&&k.push(j.folder),f!==!1&&k.push(j.hasChildren),g&&k.push(j.lastsib),c.lazy&&null===c.children&&k.push(j.lazy),c.partsel&&k.push(j.partsel),c.selected?(k.push(j.selected),h&&i.attr("aria-selected",!0)):h&&i.attr("aria-selected",!1),c.extraClasses&&k.push(c.extraClasses),f===!1?k.push(j.combinedExpanderPrefix+"n"+(g?"l":"")):k.push(j.combinedExpanderPrefix+(c.expanded?"e":"c")+(c.lazy&&null===c.children?"d":"")+(g?"l":"")),k.push(j.combinedIconPrefix+(c.expanded?"e":"c")+(c.folder?"f":"")),c[d.statusClassPropName].className=k.join(" "),c.li&&(c.li.className=g?j.lastsib:""))},nodeSetActive:function(b,c){var d,e=b.node,g=b.tree,h=b.options,i=e===g.activeNode;return c=c!==!1,e.debug("nodeSetActive",c),i===c?k(e):c&&this._triggerNodeEvent("beforeActivate",e,b.originalEvent)===!1?l(e,["rejected"]):(c?(g.activeNode&&(f(g.activeNode!==e,"node was active (inconsistency)"),d=a.extend({},b,{node:g.activeNode}),g.nodeSetActive(d,!1),f(null===g.activeNode,"deactivate was out of sync?")),h.activeVisible&&g.nodeMakeVisible(b),g.activeNode=e,g.nodeRenderStatus(b),g.nodeSetFocus(b),g._triggerNodeEvent("activate",e)):(f(g.activeNode===e,"node was not active (inconsistency)"),g.activeNode=null,this.nodeRenderStatus(b),b.tree._triggerNodeEvent("deactivate",e)),void 0)},nodeSetExpanded:function(b,c){var e,f,g,h,i,j,m=b.node,n=b.tree,o=b.options;if(c=c!==!1,m.debug("nodeSetExpanded("+c+")"),m.expanded&&c||!m.expanded&&!c)return m.debug("nodeSetExpanded("+c+"): nothing to do"),k(m);if(c&&!m.lazy&&!m.hasChildren())return l(m,["empty"]);if(!c&&m.getLevel()<o.minExpandLevel)return l(m,["locked"]);if(this._triggerNodeEvent("beforeExpand",m,b.originalEvent)===!1)return l(m,["rejected"]);if(f=new a.Deferred,c&&!m.expanded&&o.autoCollapse){i=m.getParentList(!1,!0),j=o.autoCollapse;try{for(o.autoCollapse=!1,g=0,h=i.length;h>g;g++)this._callHook("nodeCollapseSiblings",i[g])}finally{o.autoCollapse=j}}return f.done(function(){b.tree._triggerNodeEvent(c?"expand":"collapse",b),o.autoScroll&&m.getLastChild().scrollIntoView(!0,m)}),e=function(){var d,e,g,h;m.expanded=c,n._callHook("nodeRender",b,!1,!1,!0),m.ul?(g="none"!==m.ul.style.display,h=!!m.expanded,g===h?(m.warn("nodeSetExpanded: UL.style.display already set"),f.resolveWith(m)):o.fx?(d=o.fx.duration||200,e=o.fx.easing,m.debug("nodeSetExpanded: animate start..."),a(m.ul).animate(o.fx,d,e,function(){m.debug("nodeSetExpanded: animate done"),f.resolveWith(m)})):(m.ul.style.display=m.expanded||!parent?"":"none",f.resolveWith(m))):f.resolveWith(m)},c&&m.lazy&&m.hasChildren()===d?(m.debug("nodeSetExpanded: load start..."),m.lazyLoad().done(function(){m.debug("nodeSetExpanded: load done"),f.notifyWith&&f.notifyWith(m,["loaded"]),e.call(n)}).fail(function(a){f.rejectWith(m,["load failed ("+a+")"])})):e(),m.debug("nodeSetExpanded: returns"),f.promise()},nodeSetFocus:function(b,c){b.node.debug("nodeSetFocus("+c+")");var d,e=b.tree,f=b.node;if(c=c!==!1,e.focusNode){if(e.focusNode===f&&c)return f.debug("nodeSetFocus("+c+"): nothing to do"),void 0;d=a.extend({},b,{node:e.focusNode}),e.focusNode=null,this._triggerNodeEvent("blur",d),this._callHook("nodeRenderStatus",d)}c&&(r.focusTree!==e&&(f.debug("nodeSetFocus: forcing container focus"),this._callHook("treeSetFocus",b,!0,!0)),this.nodeMakeVisible(b),e.focusNode=f,this._triggerNodeEvent("focus",b),b.options.autoScroll&&f.scrollIntoView(),this._callHook("nodeRenderStatus",b))},nodeSetSelected:function(a,b){var c=a.node,d=a.tree,e=a.options;if(b=b!==!1,c.debug("nodeSetSelected("+b+")",a),!c.unselectable){if(c.selected&&b||!c.selected&&!b)return!!c.selected;if(this._triggerNodeEvent("beforeSelect",c,a.originalEvent)===!1)return!!c.selected;b&&1===e.selectMode?d.lastSelectedNode&&d.lastSelectedNode.setSelected(!1):3===e.selectMode&&(c.selected=b,c.fixSelection3AfterClick()),c.selected=b,this.nodeRenderStatus(a),d.lastSelectedNode=b?c:null,d._triggerNodeEvent("select",a)}},nodeSetStatus:function(b,c,d,e){var f,g,h=b.node,i=b.tree;switch(f=function(){var a=h.children?h.children[0]:null;if(a&&a.isStatusNode){try{h.ul&&(h.ul.removeChild(a.li),a.li=null)}catch(b){}1===h.children.length?h.children=[]:h.children.shift()}},g=function(b){var c=h.children?h.children[0]:null;return c&&c.isStatusNode?(a.extend(c,b),i._callHook("nodeRender",c)):(b.key="_statusNode",h._setChildren([b]),h.children[0].isStatusNode=!0,i.render()),h.children[0]},c){case"ok":f(),a(h.span).removeClass("fancytree-loading");break;case"loading":a(h.span).addClass("fancytree-loading"),h.parent||g({title:i.options.strings.loading+(d?" ("+d+") ":""),tooltip:e,extraClasses:"fancytree-statusnode-wait"});break;case"error":a(h.span).addClass("fancytree-error"),g({title:i.options.strings.loadError+" ("+d+")",tooltip:e,extraClasses:"fancytree-statusnode-error"});break;default:a.error("invalid status "+c)}},nodeToggleExpanded:function(a){return this.nodeSetExpanded(a,!a.node.expanded)},nodeToggleSelected:function(a){return this.nodeSetSelected(a,!a.node.selected)},treeClear:function(a){var b=a.tree;b.activeNode=null,b.focusNode=null,b.$div.find(">ul.fancytree-container").empty(),b.rootNode.children=null},treeCreate:function(){},treeDestroy:function(){},treeInit:function(a){this.treeLoad(a)},treeLoad:function(b,c){var d,f,g,h=b.tree,i=b.widget.element,j=a.extend({},b,{node:this.rootNode});if(h.rootNode.children&&this.treeClear(b),c=c||this.options.source)"string"==typeof c&&e();else switch(d=i.data("type")||"html"){case"html":f=i.find(">ul:first"),f.addClass("ui-fancytree-source ui-helper-hidden"),c=a.ui.fancytree.parseHtml(f);break;case"json":c=a.parseJSON(i.text()),c.children&&(c.title&&(h.title=c.title),c=c.children);break;default:a.error("Invalid data-type: "+d)}return g=this.nodeLoadChildren(j,c).done(function(){h.render(),3===b.options.selectMode&&h.rootNode.fixSelection3FromEndNodes(),h._triggerTreeEvent("init",!0)}).fail(function(){h.render(),h._triggerTreeEvent("init",!1)})},treeOnFocusInOut:function(b){var c="focusin"===b.type,d=a.ui.fancytree.getNode(b);try{this.debug("treeOnFocusInOut("+c+"), node=",d),f(!this._inFocusHandler,"Focus handler recursion"),this.systemFocusElement=c?b.target:null,this._inFocusHandler=!0,d?this._callHook("nodeSetFocus",d,c):this._callHook("treeSetFocus",this,c)}finally{this._inFocusHandler=!1}},treeSetFocus:function(a,b,c){b=b!==!1,this.debug("treeSetFocus("+b+"), _calledByNodeSetFocus: "+c),this.debug(" focusNode: "+this.focusNode),this.debug(" activeNode: "+this.activeNode),r.focusTree&&(this===r.focusTree&&b||(r.focusTree.focusNode&&r.focusTree.focusNode.setFocus(!1),r.focusTree.$container.removeClass("fancytree-focused"),this._triggerTreeEvent("blurTree"),r.focusTree=null)),b&&r.focusTree!==this?(r.focusTree=this,this.$container.addClass("fancytree-focused"),this.systemFocusElement||(this.debug("Set `:focus` to container"),this.$container.focus()),this.focusNode||c||(this.activeNode?this.activeNode.setFocus():this.rootNode.hasChildren()&&this.warn("NOT setting focus to first child")),this._triggerTreeEvent("focusTree")):r.focusTree=null},reactivate:function(a){var b=this.activeNode;b&&(this.activeNode=null,b.setActive(),a&&b.setFocus())},reload:function(a){return this._callHook("treeClear",this),this._callHook("treeLoad",this,a)},render:function(a,b){return this.rootNode.render(a,b)},setFocus:function(a){return this._callHook("treeSetFocus",this,a)},toDict:function(a,b){var c=this.rootNode.toDict(!0,b);return a?c:c.children},toString:function(){return"<Fancytree(#"+this._id+")>"},_triggerNodeEvent:function(b,c,e,f){var g,h=this._makeHookContext(c,e);return f&&a.extend(h,f),g=this.widget._trigger(b,e,h),g!==!1&&h.result!==d?h.result:g},_triggerTreeEvent:function(a,b){var c=this._makeHookContext(this,b),e=this.widget._trigger(a,b,c);
return e!==!1&&c.result!==d?c.result:e},visit:function(a){return this.rootNode.visit(a,!1)},warn:function(){Array.prototype.unshift.call(arguments,this.toString()),g("warn",arguments)}},a.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&#8230;",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 p(this),this.$source=this.source||"json"===this.element.data("type")?this.element:this.element.find(">ul:first");var b,c,e,g=this.options.extensions,h=this.tree;for(e=0;e<g.length;e++)c=g[e],b=a.ui.fancytree._extensions[c],b||a.error("Could not apply extension '"+c+"' (it is not registered, did you forget to include it?)"),this.tree.options[c]=a.extend(!0,{},b.options,this.tree.options[c]),f(this.tree.ext[c]===d,"Extension name must not exist as Fancytree.ext attribute: '"+c+"'"),this.tree.ext[c]={},j(this.tree,h,b,c),h=b;this.tree._callHook("treeCreate",this.tree)},_init:function(){this.tree._callHook("treeInit",this.tree),this._bind()},_setOption:function(b,c){var d=!0,e=!1;switch(b){case"aria":case"checkbox":case"icons":case"minExpandLevel":case"tabbable":this.tree._callHook("treeCreate",this.tree),e=!0;break;case"source":d=!1,this.tree._callHook("treeLoad",this.tree,c)}this.tree.debug("set option "+b+"="+c+" <"+typeof c+">"),d&&a.Widget.prototype._setOption.apply(this,arguments),e&&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"),a.Widget.prototype.destroy.call(this)},_unbind:function(){var b=this.tree._ns;this.element.unbind(b),this.tree.$container.unbind(b),a(c).unbind(b)},_bind:function(){var b=this,d=this.options,e=this.tree,f=e._ns,g=a.support.selectstart?"selectstart":"mousedown";this._unbind(),e.debug("bind events; container: ",e.$container),e.$container.bind("focusin"+f+" focusout"+f,function(a){e.debug("Tree container got event "+a.type),e.treeOnFocusInOut.call(e,a)}).delegate("span.fancytree-title",g+f,function(a){e.debug("<span> got event "+a.type),a.preventDefault()}),a(c).bind("keydown"+f,function(a){if(e.debug("doc got event "+a.type+", hasFocus:"+e.hasFocus()),d.disabled||d.keyboard===!1||!e.hasFocus())return!0;var b=e.focusNode,c=e._makeHookContext(b||e,a),f=e.phase;try{return e.phase="userEvent",b?e._triggerNodeEvent("keydown",b,a)===!1?!1:e._callHook("nodeKeydown",c):e._triggerTreeEvent("keydown",a)===!1?!1:e._callHook("nodeKeydown",c)}finally{e.phase=f}}),this.element.bind("click"+f+" dblclick"+f,function(a){if(d.disabled)return!0;var c,e=r.getEventTarget(a),f=e.node,g=b.tree,h=g.phase;if(!f)return!0;c=g._makeHookContext(f,a);try{switch(g.phase="userEvent",a.type){case"click":return c.targetType=e.type,g._triggerNodeEvent("click",c,a)===!1?!1:g._callHook("nodeClick",c);case"dblclick":return c.targetType=e.type,g._triggerNodeEvent("dblclick",c,a)===!1?!1:g._callHook("nodeDblclick",c)}}finally{g.phase=h}})},getActiveNode:function(){return this.tree.activeNode},getNodeByKey:function(a){return this.tree.getNodeByKey(a)},getRootNode:function(){return this.tree.rootNode},getTree:function(){return this.tree}}),r=a.ui.fancytree,a.extend(a.ui.fancytree,{version:"2.0.0-4",buildType:"release",debugLevel:1,_nextId:1,_nextNodeKey:1,_extensions:{},focusTree:null,_FancytreeClass:p,_FancytreeNodeClass:o,jquerySupports:{positionMyOfs:h(a.ui.version,1,9)},assert:function(a,b){return f(a,b)},debug:function(){a.ui.fancytree.debugLevel>=2&&g("log",arguments)},error:function(){g("error",arguments)},getEventTargetType:function(a){return this.getEventTarget(a).type},getEventTarget:function(a){var b=a&&a.target?a.target.className:"",c={node:this.getNode(a.target),type:d};return"fancytree-title"===b?c.type="title":"fancytree-expander"===b?c.type=c.node.hasChildren()===!1?"prefix":"expander":"fancytree-checkbox"===b?c.type="checkbox":"fancytree-icon"===b?c.type="icon":b.indexOf("fancytree-node")>=0&&(c.type="title"),c},getNode:function(a){if(a instanceof o)return a;for(a.selector!==d?a=a[0]:a.originalEvent!==d&&(a=a.target);a;){if(a.ftnode)return a.ftnode;a=a.parentNode}return null},info:function(){a.ui.fancytree.debugLevel>=1&&g("info",arguments)},parseHtml:function(b){var c,e,f,g,h,i,j,k=b.find(">li"),l=[];return k.each(function(){var k,m,n=a(this),o=n.find(">span:first",this),p=o.length?null:n.find(">a:first"),q={tooltip:null,data:{}};for(o.length?q.title=o.html():p&&p.length?(q.title=p.html(),q.data.href=p.attr("href"),q.data.target=p.attr("target"),q.tooltip=p.attr("title")):(q.title=n.html(),g=q.title.search(/<ul/i),g>=0&&(q.title=q.title.substring(0,g))),q.title=a.trim(q.title),e=0,f=s.length;f>e;e++)q[s[e]]=d;for(i=this.className.split(" "),c=[],e=0,f=i.length;f>e;e++)j=i[e],t[j]?q[j]=!0:c.push(j);q.extraClasses=c.join(" "),h=n.attr("title"),h&&(q.tooltip=h),h=n.attr("id"),h&&(q.key=h),k=n.data(),k&&!a.isEmptyObject(k)&&(m=k.json,delete k.json,a.extend(q.data,k),m&&a.extend(q.data,m)),b=n.find(">ul:first"),q.children=b.length?a.ui.fancytree.parseHtml(b):q.lazy?d:null,l.push(q)}),l},registerExtension:function(b,c){a.ui.fancytree._extensions[b]=c},warn:function(){g("warn",arguments)}})}(jQuery,window,document);
//# sourceMappingURL=jquery.fancytree.min.js.map
\ No newline at end of file
* Copyright (c) 2014 Martin Wendt; Licensed MIT */
!function(a,b,c,d){"use strict";function e(b){b=b||"",a.error("Not implemented: "+b)}function f(b,c){b||(c=c?": "+c:"",a.error("Assertion failed"+c))}function g(a,c){var d,e,f=b.console?b.console[a]:null;if(f)if(f.apply)f.apply(b.console,c);else{for(e="",d=0;d<c.length;d++)e+=c[d];f(e)}}function h(b){var c,d,e,f=a.map(a.trim(b).split("."),function(a){return parseInt(a,10)}),g=a.map(Array.prototype.slice.call(arguments,1),function(a){return parseInt(a,10)});for(c=0;c<g.length;c++)if(d=f[c]||0,e=g[c]||0,d!==e)return d>e;return!0}function i(a,b,c,d,e){var f=function(){var c=b[a],f=d[a],g=b.ext[e],h=function(){return c.apply(b,arguments)};return function(){var a=b._local,c=b._super;try{return b._local=g,b._super=h,f.apply(b,arguments)}finally{b._local=a,b._super=c}}}();return f}function j(b,c,d,e){for(var f in d)"function"==typeof d[f]?"function"==typeof b[f]?b[f]=i(f,b,c,d,e):"_"===f.charAt(0)?b.ext[e][f]=i(f,b,c,d,e):a.error("Could not override tree."+f+". Use prefix '_' to create tree."+e+"._"+f):"options"!==f&&(b.ext[e][f]=d[f])}function k(b,c){return b===d?a.Deferred(function(){this.resolve()}).promise():a.Deferred(function(){this.resolveWith(b,c)}).promise()}function l(b,c){return b===d?a.Deferred(function(){this.reject()}).promise():a.Deferred(function(){this.rejectWith(b,c)}).promise()}function m(a,b){return function(){a.resolveWith(b)}}function n(a){return a=a.toLowerCase(),function(b){return b.title.toLowerCase().indexOf(a)>=0}}function o(b,c){var d,e,g,h;for(this.parent=b,this.tree=b.tree,this.ul=null,this.li=null,this.statusNodeType=null,this._isLoading=!1,this.data={},d=0,e=v.length;e>d;d++)g=v[d],this[g]=c[g];c.data&&a.extend(this.data,c.data);for(g in c)w[g]||a.isFunction(c[g])||x[g]||(this.data[g]=c[g]);null==this.key&&(this.tree.options.defaultKey?(this.key=this.tree.options.defaultKey(this),f(this.key,"defaultKey() must return a unique key")):this.key="_"+r._nextNodeKey++),c.active&&(f(null===this.tree.activeNode,"only one active node allowed"),this.tree.activeNode=this),this.children=null,h=c.children,h&&h.length&&this._setChildren(h),this.tree._callHook("treeRegisterNode",this.tree,!0,this)}function p(b){this.widget=b,this.$div=b.element,this.options=b.options,this.options&&a.isFunction(this.options.lazyload)&&(a.isFunction(this.options.lazyLoad)||(this.options.lazyLoad=function(){r.warn("The 'lazyload' event is deprecated since 2014-02-25. Use 'lazyLoad' (with uppercase L) instead."),b.options.lazyload.apply(this,arguments)})),this.ext={},this.data={},this._id=a.ui.fancytree._nextId++,this._ns=".fancytree-"+this._id,this.activeNode=null,this.focusNode=null,this._hasFocus=null,this.lastSelectedNode=null,this.systemFocusElement=null,this.statusClassPropName="span",this.ariaPropName="li",this.nodeContainerAttrName="li",this.$div.find(">ul.fancytree-container").remove();var c,d={tree:this};this.rootNode=new o(d,{title:"root",key:"root_"+this._id,children:null,expanded:!0}),this.rootNode.parent=null,c=a("<ul>",{"class":"ui-fancytree fancytree-container"}).appendTo(this.$div),this.$container=c,this.rootNode.ul=c[0],null==this.options.debugLevel&&(this.options.debugLevel=r.debugLevel),this.$container.attr("tabindex",this.options.tabbable?"0":"-1"),this.options.aria&&this.$container.attr("role","tree").attr("aria-multiselectable",!0)}if(a.ui.fancytree&&a.ui.fancytree.version)return a.ui.fancytree.warn("Fancytree: ignored duplicate include"),void 0;var q,r=null,s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},t="active expanded focus folder hideCheckbox lazy selected unselectable".split(" "),u={},v="expanded extraClasses folder hideCheckbox key lazy refKey selected title tooltip unselectable".split(" "),w={},x={active:!0,children:!0,data:!0,focus:!0};for(q=0;q<t.length;q++)u[t[q]]=!0;for(q=0;q<v.length;q++)w[v[q]]=!0;o.prototype={_findDirectChild:function(a){var b,c,d=this.children;if(d)if("string"==typeof a){for(b=0,c=d.length;c>b;b++)if(d[b].key===a)return d[b]}else{if("number"==typeof a)return this.children[a];if(a.parent===this)return a}return null},_setChildren:function(a){f(a&&(!this.children||0===this.children.length),"only init supported"),this.children=[];for(var b=0,c=a.length;c>b;b++)this.children.push(new o(this,a[b]))},addChildren:function(b,c){var d,e,g,h=null,i=[];for(a.isPlainObject(b)&&(b=[b]),this.children||(this.children=[]),d=0,e=b.length;e>d;d++)i.push(new o(this,b[d]));return h=i[0],null==c?this.children=this.children.concat(i):(c=this._findDirectChild(c),g=a.inArray(c,this.children),f(g>=0,"insertBefore must be an existing child"),this.children.splice.apply(this.children,[g,0].concat(i))),(!this.parent||this.parent.ul||this.tr)&&this.render(),3===this.tree.options.selectMode&&this.fixSelection3FromEndNodes(),h},addNode:function(a,b){switch((b===d||"over"===b)&&(b="child"),b){case"after":return this.getParent().addChildren(a,this.getNextSibling());case"before":return this.getParent().addChildren(a,this);case"child":case"over":return this.addChildren(a)}f(!1,"Invalid mode: "+b)},applyPatch:function(b){if(null===b)return this.remove(),k(this);var c,d,e,f={children:!0,expanded:!0,parent:!0};for(c in b)e=b[c],f[c]||a.isFunction(e)||(w[c]?this[c]=e:this.data[c]=e);return b.hasOwnProperty("children")&&(this.removeChildren(),b.children&&this._setChildren(b.children)),this.isVisible()&&(this.renderTitle(),this.renderStatus()),d=b.hasOwnProperty("expanded")?this.setExpanded(b.expanded):k(this)},collapseSiblings:function(){return this.tree._callHook("nodeCollapseSiblings",this)},copyTo:function(a,b,c){return a.addNode(this.toDict(!0,c),b)},countChildren:function(a){var b,c,d,e=this.children;if(!e)return 0;if(d=e.length,a!==!1)for(b=0,c=d;c>b;b++)d+=e[b].countChildren();return d},debug:function(){this.tree.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),g("debug",arguments))},discard:function(){return this.warn("FancytreeNode.discard() is deprecated since 2014-02-16. Use .resetLazy() instead."),this.resetLazy()},findAll:function(b){b=a.isFunction(b)?b:n(b);var c=[];return this.visit(function(a){b(a)&&c.push(a)}),c},findFirst:function(b){b=a.isFunction(b)?b:n(b);var c=null;return this.visit(function(a){return b(a)?(c=a,!1):void 0}),c},_changeSelectStatusAttrs:function(a){var b=!1;switch(a){case!1:b=this.selected||this.partsel,this.selected=!1,this.partsel=!1;break;case!0:b=!this.selected||!this.partsel,this.selected=!0,this.partsel=!0;break;case d:b=this.selected||!this.partsel,this.selected=!1,this.partsel=!0;break;default:f(!1,"invalid state: "+a)}return b&&this.renderStatus(),b},fixSelection3AfterClick:function(){var a=this.isSelected();this.visit(function(b){b._changeSelectStatusAttrs(a)}),this.fixSelection3FromEndNodes()},fixSelection3FromEndNodes:function(){function a(b){var c,e,f,g,h,i,j,k=b.children;if(k){for(i=!0,j=!1,c=0,e=k.length;e>c;c++)f=k[c],g=a(f),g!==!1&&(j=!0),g!==!0&&(i=!1);h=i?!0:j?d:!1}else h=!!b.selected;return b._changeSelectStatusAttrs(h),h}f(3===this.tree.options.selectMode,"expected selectMode 3"),a(this),this.visitParents(function(a){var b,c,e,f,g=a.children,h=!0,i=!1;for(b=0,c=g.length;c>b;b++)e=g[b],(e.selected||e.partsel)&&(i=!0),e.unselectable||e.selected||(h=!1);f=h?!0:i?d:!1,a._changeSelectStatusAttrs(f)})},fromDict:function(b){for(var c in b)w[c]?this[c]=b[c]:"data"===c?a.extend(this.data,b.data):a.isFunction(b[c])||x[c]||(this.data[c]=b[c]);b.children?(this.removeChildren(),this.addChildren(b.children)):this.renderTitle()},getChildren:function(){return this.hasChildren()===d?d:this.children},getFirstChild:function(){return this.children?this.children[0]:null},getIndex:function(){return a.inArray(this,this.parent.children)},getIndexHier:function(b){b=b||".";var c=[];return a.each(this.getParentList(!1,!0),function(a,b){c.push(b.getIndex()+1)}),c.join(b)},getKeyPath:function(a){var b=[],c=this.tree.options.keyPathSeparator;return this.visitParents(function(a){a.parent&&b.unshift(a.key)},!a),c+b.join(c)},getLastChild:function(){return this.children?this.children[this.children.length-1]:null},getLevel:function(){for(var a=0,b=this.parent;b;)a++,b=b.parent;return a},getNextSibling:function(){if(this.parent){var a,b,c=this.parent.children;for(a=0,b=c.length-1;b>a;a++)if(c[a]===this)return c[a+1]}return null},getParent:function(){return this.parent},getParentList:function(a,b){for(var c=[],d=b?this:this.parent;d;)(a||d.parent)&&c.unshift(d),d=d.parent;return c},getPrevSibling:function(){if(this.parent){var a,b,c=this.parent.children;for(a=1,b=c.length;b>a;a++)if(c[a]===this)return c[a-1]}return null},hasChildren:function(){return this.lazy?null==this.children?d:0===this.children.length?!1:1===this.children.length&&this.children[0].isStatusNode()?d:!0:!!this.children},hasFocus:function(){return this.tree.hasFocus()&&this.tree.focusNode===this},isActive:function(){return this.tree.activeNode===this},isChildOf:function(a){return this.parent&&this.parent===a},isDescendantOf:function(a){if(!a||a.tree!==this.tree)return!1;for(var b=this.parent;b;){if(b===a)return!0;b=b.parent}return!1},isExpanded:function(){return!!this.expanded},isFirstSibling:function(){var a=this.parent;return!a||a.children[0]===this},isFolder:function(){return!!this.folder},isLastSibling:function(){var a=this.parent;return!a||a.children[a.children.length-1]===this},isLazy:function(){return!!this.lazy},isLoaded:function(){return!this.lazy||this.hasChildren()!==d},isLoading:function(){return!!this._isLoading},isRoot:function(){return this.tree.rootNode===this},isSelected:function(){return!!this.selected},isStatusNode:function(){return!!this.statusNodeType},isUndefined:function(){return this.hasChildren()===d},isVisible:function(){var a,b,c=this.getParentList(!1,!1);for(a=0,b=c.length;b>a;a++)if(!c[a].expanded)return!1;return!0},lazyLoad:function(a){return this.warn("FancytreeNode.lazyLoad() is deprecated since 2014-02-16. Use .load() instead."),this.load(a)},load:function(a){var b,c,d=this;return f(this.isLazy(),"load() requires a lazy node"),f(a||this.isUndefined(),"Pass forceReload=true to re-load a lazy node"),this.isLoaded()&&this.resetLazy(),c=this.tree._triggerNodeEvent("lazyLoad",this),f("boolean"!=typeof c,"lazyLoad event must return source in data.result"),b=this.tree._callHook("nodeLoadChildren",this,c),this.expanded&&b.always(function(){d.render()}),b},makeVisible:function(b){var c,d=this,e=[],f=new a.Deferred,g=this.getParentList(!1,!1),h=g.length,i=!(b&&b.noAnimation===!0),j=!(b&&b.scrollIntoView===!1);for(c=h-1;c>=0;c--)e.push(g[c].setExpanded(!0,b));return a.when.apply(a,e).done(function(){j?d.scrollIntoView(i).done(function(){f.resolve()}):f.resolve()}),f.promise()},moveTo:function(b,c,e){(c===d||"over"===c)&&(c="child");var g,h=this.parent,i="child"===c?b:b.parent;if(this!==b){if(!this.parent)throw"Cannot move system root";if(i.isDescendantOf(this))throw"Cannot move a node to its own descendant";if(1===this.parent.children.length?(this.parent.children=this.parent.lazy?[]:null,this.parent.expanded=!1):(g=a.inArray(this,this.parent.children),f(g>=0),this.parent.children.splice(g,1)),this.parent=i,i.hasChildren())switch(c){case"child":i.children.push(this);break;case"before":g=a.inArray(b,i.children),f(g>=0),i.children.splice(g,0,this);break;case"after":g=a.inArray(b,i.children),f(g>=0),i.children.splice(g+1,0,this);break;default:throw"Invalid mode "+c}else i.children=[this];e&&b.visit(e,!0),this.tree!==b.tree&&(this.warn("Cross-tree moveTo is experimantal!"),this.visit(function(a){a.tree=b.tree},!0)),h.isDescendantOf(i)||h.render(),i.isDescendantOf(h)||i===h||i.render()}},navigate:function(b,c){function d(d){return d?(d.makeVisible(),a(d.span).is(":visible")?c===!1?d.setFocus():d.setActive():(d.debug("Navigate: skipping hidden node"),d.navigate(b,c),void 0)):void 0}var e,f,g=!0,h=a.ui.keyCode,i=null;switch(b){case h.BACKSPACE:this.parent&&this.parent.parent&&d(this.parent);break;case h.LEFT:this.expanded?(this.setExpanded(!1),d(this)):this.parent&&this.parent.parent&&d(this.parent);break;case h.RIGHT:this.expanded||!this.children&&!this.lazy?this.children&&this.children.length&&d(this.children[0]):(this.setExpanded(),d(this));break;case h.UP:for(i=this.getPrevSibling();i&&i.expanded&&i.children&&i.children.length;)i=i.children[i.children.length-1];!i&&this.parent&&this.parent.parent&&(i=this.parent),d(i);break;case h.DOWN:if(this.expanded&&this.children&&this.children.length)i=this.children[0];else for(f=this.getParentList(!1,!0),e=f.length-1;e>=0&&!(i=f[e].getNextSibling());e--);d(i);break;default:g=!1}},remove:function(){return this.parent.removeChild(this)},removeChild:function(a){return this.tree._callHook("nodeRemoveChild",this,a)},removeChildren:function(){return this.tree._callHook("nodeRemoveChildren",this)},render:function(a,b){return this.tree._callHook("nodeRender",this,a,b)},renderTitle:function(){return this.tree._callHook("nodeRenderTitle",this)},renderStatus:function(){return this.tree._callHook("nodeRenderStatus",this)},resetLazy:function(){this.removeChildren(),this.expanded=!1,this.lazy=!0,this.children=d,this.renderStatus()},scheduleAction:function(a,b){this.tree.timer&&clearTimeout(this.tree.timer),this.tree.timer=null;var c=this;switch(a){case"cancel":break;case"expand":this.tree.timer=setTimeout(function(){c.tree.debug("setTimeout: trigger expand"),c.setExpanded(!0)},b);break;case"activate":this.tree.timer=setTimeout(function(){c.tree.debug("setTimeout: trigger activate"),c.setActive(!0)},b);break;default:throw"Invalid mode "+a}},scrollIntoView:function(b,c){b=b===!0?{duration:200,queue:!1}:b;var d,e=new a.Deferred,f=this,g=a(this.span).position().top,h=a(this.span).height(),i=this.tree.$container,j=i[0].scrollTop,k=Math.max(0,i.innerHeight()-i[0].clientHeight),l=i.height()-k,m=null;return 0>g?m=j+g:g+h>l&&(m=j+g-l+h,c&&(d=c?a(c.span).position().top:0,g-d>l&&(m=j+d))),null!==m?b?(b.complete=function(){e.resolveWith(f)},i.animate({scrollTop:m},b)):(i[0].scrollTop=m,e.resolveWith(this)):e.resolveWith(this),e.promise()},setActive:function(a,b){return this.tree._callHook("nodeSetActive",this,a,b)},setExpanded:function(a,b){return this.tree._callHook("nodeSetExpanded",this,a,b)},setFocus:function(a){return this.tree._callHook("nodeSetFocus",this,a)},setSelected:function(a){return this.tree._callHook("nodeSetSelected",this,a)},setTitle:function(a){this.title=a,this.renderTitle()},sortChildren:function(a,b){var c,d,e=this.children;if(e){if(a=a||function(a,b){var c=a.title.toLowerCase(),d=b.title.toLowerCase();return c===d?0:c>d?1:-1},e.sort(a),b)for(c=0,d=e.length;d>c;c++)e[c].children&&e[c].sortChildren(a,"$norender$");"$norender$"!==b&&this.render()}},toDict:function(b,c){var d,e,f,g={},h=this;if(a.each(v,function(a,b){(h[b]||h[b]===!1)&&(g[b]=h[b])}),a.isEmptyObject(this.data)||(g.data=a.extend({},this.data),a.isEmptyObject(g.data)&&delete g.data),c&&c(g),b&&this.hasChildren())for(g.children=[],d=0,e=this.children.length;e>d;d++)f=this.children[d],f.isStatusNode()||g.children.push(f.toDict(!0,c));return g},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(a,b){var c,d,e=!0,f=this.children;if(b===!0&&(e=a(this),e===!1||"skip"===e))return e;if(f)for(c=0,d=f.length;d>c&&(e=f[c].visit(a,!0),e!==!1);c++);return e},visitParents:function(a,b){if(b&&a(this)===!1)return!1;for(var c=this.parent;c;){if(a(c)===!1)return!1;c=c.parent}return!0},warn:function(){Array.prototype.unshift.call(arguments,this.toString()),g("warn",arguments)}},p.prototype={_makeHookContext:function(b,c,e){var f,g;return b.node!==d?(c&&b.originalEvent!==c&&a.error("invalid args"),f=b):b.tree?(g=b.tree,f={node:b,tree:g,widget:g.widget,options:g.widget.options,originalEvent:c}):b.widget?f={node:null,tree:b,widget:b.widget,options:b.widget.options,originalEvent:c}:a.error("invalid args"),e&&a.extend(f,e),f},_callHook:function(b,c){var d=this._makeHookContext(c),e=this[b],f=Array.prototype.slice.call(arguments,2);return a.isFunction(e)||a.error("_callHook('"+b+"') is not a function"),f.unshift(d),e.apply(this,f)},_requireExtension:function(b,c,d,e){d=!!d;var g=this._local.name,h=this.options.extensions,i=a.inArray(b,h)<a.inArray(g,h),j=c&&null==this.ext[b],k=!j&&null!=d&&d!==i;return f(g&&g!==b),j||k?(e||(j||c?(e="'"+g+"' extension requires '"+b+"'",k&&(e+=" to be registered "+(d?"before":"after")+" itself")):e="If used together, `"+b+"` must be registered "+(d?"before":"after")+" `"+g+"`"),a.error(e),!1):!0},activateKey:function(a){var b=this.getNodeByKey(a);return b?b.setActive():this.activeNode&&this.activeNode.setActive(!1),b},applyPatch:function(b){var c,d,e,g,h,i,j=b.length,k=[];for(d=0;j>d;d++)e=b[d],f(2===e.length,"patchList must be an array of length-2-arrays"),g=e[0],h=e[1],i=null===g?this.rootNode:this.getNodeByKey(g),i?(c=new a.Deferred,k.push(c),i.applyPatch(h).always(m(c,i))):this.warn("could not find node with key '"+g+"'");return a.when.apply(a,k).promise()},count:function(){return this.rootNode.countChildren()},debug:function(){this.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),g("debug",arguments))},generateFormElements:function(b,c){var d,e=b!==!1?"ft_"+this._id:b,f=c!==!1?"ft_"+this._id+"_active":c,g="fancytree_result_"+this._id,h=this.$container.find("div#"+g);h.length?h.empty():h=a("<div>",{id:g}).hide().appendTo(this.$container),e&&(d=this.getSelectedNodes(3===this.options.selectMode),a.each(d,function(b,c){h.append(a("<input>",{type:"checkbox",name:e,value:c.key,checked:!0}))})),f&&this.activeNode&&h.append(a("<input>",{type:"radio",name:f,value:this.activeNode.key,checked:!0}))},getActiveNode:function(){return this.activeNode},getFirstChild:function(){return this.rootNode.getFirstChild()},getFocusNode:function(){return this.focusNode},getNodeByKey:function(a,b){var d,e;return!b&&(d=c.getElementById(this.options.idPrefix+a))?d.ftnode?d.ftnode:null:(b=b||this.rootNode,e=null,b.visit(function(b){return b.key===a?(e=b,!1):void 0},!0),e)},getSelectedNodes:function(a){var b=[];return this.rootNode.visit(function(c){return c.selected&&(b.push(c),a===!0)?"skip":void 0}),b},hasFocus:function(){return!!this._hasFocus},info:function(){this.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),g("info",arguments))},loadKeyPath:function(b,c,e){function f(a,b,d){c.call(r,b,"loading"),b.load().done(function(){r.loadKeyPath.call(r,l[a],c,b).always(m(d,r))}).fail(function(){r.warn("loadKeyPath: error loading: "+a+" (parent: "+p+")"),c.call(r,b,"error"),d.reject()})}var g,h,i,j,k,l,n,o,p=e||this.rootNode,q=this.options.keyPathSeparator,r=this;for(a.isArray(b)||(b=[b]),l={},i=0;i<b.length;i++)for(j=b[i],j.charAt(0)===q&&(j=j.substr(1)),o=j.split(q);o.length;){if(k=o.shift(),n=p._findDirectChild(k),!n){this.warn("loadKeyPath: key not found: "+k+" (parent: "+p+")"),c.call(this,k,"error");break}if(0===o.length){c.call(this,n,"ok");break}if(n.lazy&&n.hasChildren()===d){c.call(this,n,"loaded"),l[k]?l[k].push(o.join(q)):l[k]=[o.join(q)];break}c.call(this,n,"loaded"),p=n}g=[];for(k in l)n=p._findDirectChild(k),h=new a.Deferred,g.push(h),f(k,n,h);return a.when.apply(a,g).promise()},reactivate:function(a){var b=this.activeNode;b&&(this.activeNode=null,b.setActive(),a&&b.setFocus())},reload:function(a){return this._callHook("treeClear",this),this._callHook("treeLoad",this,a)},render:function(a,b){return this.rootNode.render(a,b)},setFocus:function(a){return this._callHook("treeSetFocus",this,a)},toDict:function(a,b){var c=this.rootNode.toDict(!0,b);return a?c:c.children},toString:function(){return"<Fancytree(#"+this._id+")>"},_triggerNodeEvent:function(a,b,c,e){var f=this._makeHookContext(b,c,e),g=this.widget._trigger(a,c,f);return g!==!1&&f.result!==d?f.result:g},_triggerTreeEvent:function(a,b){var c=this._makeHookContext(this,b),e=this.widget._trigger(a,b,c);return e!==!1&&c.result!==d?c.result:e},visit:function(a){return this.rootNode.visit(a,!1)},warn:function(){Array.prototype.unshift.call(arguments,this.toString()),g("warn",arguments)}},a.extend(p.prototype,{nodeClick:function(a){var b,c,d=a.originalEvent,e=a.targetType,f=a.node;if("expander"===e)this._callHook("nodeToggleExpanded",a);else if("checkbox"===e)this._callHook("nodeToggleSelected",a),this._callHook("nodeSetFocus",a,!0);else{if(c=!1,b=!0,f.folder)switch(a.options.clickFolderMode){case 2:c=!0,b=!1;break;case 3:b=!0,c=!0}b&&(this.nodeSetFocus(a),this._callHook("nodeSetActive",a,!0)),c&&this._callHook("nodeToggleExpanded",a)}"a"===d.target.localName&&"fancytree-title"===d.target.className&&d.preventDefault()},nodeCollapseSiblings:function(a,b){var c,d,e,f=a.node;if(f.parent)for(c=f.parent.children,d=0,e=c.length;e>d;d++)c[d]!==f&&c[d].expanded&&this._callHook("nodeSetExpanded",c[d],!1,b)},nodeDblclick:function(a){"title"===a.targetType&&4===a.options.clickFolderMode&&this._callHook("nodeToggleExpanded",a),"title"===a.targetType&&a.originalEvent.preventDefault()},nodeKeydown:function(b){var c,d=b.originalEvent,e=b.node,f=b.tree,g=b.options,h=!0,i=!(d.ctrlKey||!g.autoActivate),j=a.ui.keyCode;switch(e||(this.rootNode.getFirstChild().setFocus(),e=b.node=this.focusNode,e.debug("Keydown force focus on first node")),d.which){case j.NUMPAD_ADD:case 187:f.nodeSetExpanded(b,!0);break;case j.NUMPAD_SUBTRACT:case 189:f.nodeSetExpanded(b,!1);break;case j.SPACE:g.checkbox?f.nodeToggleSelected(b):f.nodeSetActive(b,!0);break;case j.ENTER:f.nodeSetActive(b,!0);break;case j.BACKSPACE:case j.LEFT:case j.RIGHT:case j.UP:case j.DOWN:c=e.navigate(d.which,i);break;default:h=!1}h&&d.preventDefault()},nodeLoadChildren:function(b,c){var d,e,g=b.tree,h=b.node;return a.isFunction(c)&&(c=c()),c.url&&(d=a.extend({},b.options.ajax,c),d.debugDelay?(e=d.debugDelay,a.isArray(e)&&(e=e[0]+Math.random()*(e[1]-e[0])),h.debug("nodeLoadChildren waiting debug delay "+Math.round(e)+"ms"),d.debugDelay=!1,c=a.Deferred(function(b){setTimeout(function(){a.ajax(d).done(function(){b.resolveWith(this,arguments)}).fail(function(){b.rejectWith(this,arguments)})},e)})):c=a.ajax(d),c=c.pipe(function(c){var d;return"string"==typeof c&&a.error("Ajax request returned a string (did you get the JSON dataType wrong?)."),b.options.postProcess?(d=g._triggerNodeEvent("postProcess",b,b.originalEvent,{response:c,dataType:this.dataType}),c=a.isArray(d)?d:c):c&&c.hasOwnProperty("d")&&b.options.enableAspx&&(c="string"==typeof c.d?a.parseJSON(c.d):c.d),c},function(a,b,c){return g._makeHookContext(h,null,{error:a,args:Array.prototype.slice.call(arguments),message:c,details:a.status+": "+c})})),a.isFunction(c.promise)&&(f(!h.isLoading()),h._isLoading=!0,g.nodeSetStatus(b,"loading"),c.done(function(){g.nodeSetStatus(b,"ok")}).fail(function(a){var c;c=a.node&&a.error&&a.message?a:g._makeHookContext(h,null,{error:a,args:Array.prototype.slice.call(arguments),message:a?a.message||a.toString():""}),g._triggerNodeEvent("loaderror",c,null),g.nodeSetStatus(b,"error",c.message,c.details)})),a.when(c).done(function(b){var c;a.isPlainObject(b)&&(f(a.isArray(b.children),"source must contain (or be) an array of children"),f(h.isRoot(),"source may only be an object for root nodes"),c=b,b=b.children,delete c.children,a.extend(g.data,c)),f(a.isArray(b),"expected array of children"),h._setChildren(b),g._triggerNodeEvent("loadChildren",h)}).always(function(){h._isLoading=!1})},nodeLoadKeyPath:function(){},nodeRemoveChild:function(b,c){var d,e=b.node,g=b.options,h=a.extend({},b,{node:c}),i=e.children;return 1===i.length?(f(c===i[0]),this.nodeRemoveChildren(b)):(this.activeNode&&(c===this.activeNode||this.activeNode.isDescendantOf(c))&&this.activeNode.setActive(!1),this.focusNode&&(c===this.focusNode||this.focusNode.isDescendantOf(c))&&(this.focusNode=null),this.nodeRemoveMarkup(h),this.nodeRemoveChildren(h),d=a.inArray(c,i),f(d>=0),c.visit(function(a){a.parent=null},!0),this._callHook("treeRegisterNode",this,!1,c),g.removeNode&&g.removeNode.call(b.tree,{type:"removeNode"},h),i.splice(d,1),void 0)},nodeRemoveChildMarkup:function(b){var c=b.node;c.ul&&(c.isRoot()?a(c.ul).empty():(a(c.ul).remove(),c.ul=null),c.visit(function(a){a.li=a.ul=null}))},nodeRemoveChildren:function(b){var c,d=b.tree,e=b.node,f=e.children,g=b.options;f&&(this.activeNode&&this.activeNode.isDescendantOf(e)&&this.activeNode.setActive(!1),this.focusNode&&this.focusNode.isDescendantOf(e)&&(this.focusNode=null),this.nodeRemoveChildMarkup(b),c=a.extend({},b),e.visit(function(a){a.parent=null,d._callHook("treeRegisterNode",d,!1,a),g.removeNode&&(c.node=a,g.removeNode.call(b.tree,{type:"removeNode"},c))}),e.children=e.lazy?[]:null,this.nodeRenderStatus(b))},nodeRemoveMarkup:function(b){var c=b.node;c.li&&(a(c.li).remove(),c.li=null),this.nodeRemoveChildMarkup(b)},nodeRender:function(b,d,e,g,h){var i,j,k,l,m,n,o,p=b.node,q=b.tree,r=b.options,s=r.aria,t=!1,u=p.parent,v=!u,w=p.children;if(v||u.ul){if(f(v||u.ul,"parent UL must exist"),v||(p.li&&(d||p.li.parentNode!==p.parent.ul)&&(p.li.parentNode!==p.parent.ul&&this.warn("unlink "+p+" (must be child of "+p.parent+")"),this.nodeRemoveMarkup(b)),p.li?this.nodeRenderStatus(b):(t=!0,p.li=c.createElement("li"),p.li.ftnode=p,p.key&&r.generateIds&&(p.li.id=r.idPrefix+p.key),p.span=c.createElement("span"),p.span.className="fancytree-node",s&&a(p.span).attr("aria-labelledby","ftal_"+p.key),p.li.appendChild(p.span),this.nodeRenderTitle(b),r.createNode&&r.createNode.call(q,{type:"createNode"},b)),r.renderNode&&r.renderNode.call(q,{type:"renderNode"},b)),w){if(v||p.expanded||e===!0){for(p.ul||(p.ul=c.createElement("ul"),(g===!0&&!h||!p.expanded)&&(p.ul.style.display="none"),s&&a(p.ul).attr("role","group"),p.li?p.li.appendChild(p.ul):p.tree.$div.append(p.ul)),l=0,m=w.length;m>l;l++)o=a.extend({},b,{node:w[l]}),this.nodeRender(o,d,e,!1,!0);for(i=p.ul.firstChild;i;)k=i.ftnode,k&&k.parent!==p?(p.debug("_fixParent: remove missing "+k,i),n=i.nextSibling,i.parentNode.removeChild(i),i=n):i=i.nextSibling;for(i=p.ul.firstChild,l=0,m=w.length-1;m>l;l++)j=w[l],k=i.ftnode,j!==k?p.ul.insertBefore(j.li,k.li):i=i.nextSibling}}else p.ul&&(this.warn("remove child markup for "+p),this.nodeRemoveChildMarkup(b));v||t&&u.ul.appendChild(p.li)}},nodeRenderTitle:function(a,b){var c,e,f,g,h,i,j=a.node,k=a.tree,l=a.options,m=l.aria,n=j.getLevel(),o=[],p=j.data.icon;b!==d&&(j.title=b),j.span&&(n<l.minExpandLevel?n>1&&(m?o.push("<span role='button' class='fancytree-expander'></span>"):o.push("<span class='fancytree-expander'></span>")):m?o.push("<span role='button' class='fancytree-expander'></span>"):o.push("<span class='fancytree-expander'></span>"),l.checkbox&&j.hideCheckbox!==!0&&!j.isStatusNode()&&(m?o.push("<span role='checkbox' class='fancytree-checkbox'></span>"):o.push("<span class='fancytree-checkbox'></span>")),g=m?" role='img'":"",p&&"string"==typeof p?(e="/"===p.charAt(0)?p:l.imagePath+p,o.push("<img src='"+e+"' alt='' />")):j.data.iconclass?o.push("<span "+g+" class='fancytree-custom-icon"+" "+j.data.iconclass+"'></span>"):(p===!0||p!==!1&&l.icons!==!1)&&o.push("<span "+g+" class='fancytree-icon'></span>"),f="",l.renderTitle&&(f=l.renderTitle.call(k,{type:"renderTitle"},a)||""),f||(i=j.tooltip?" title='"+j.tooltip.replace(/\"/g,"&quot;")+"'":"",c=m?" id='ftal_"+j.key+"'":"",g=m?" role='treeitem'":"",h=l.titlesTabbable?" tabindex='0'":"",f="<span "+g+" class='fancytree-title'"+c+i+h+">"+j.title+"</span>"),o.push(f),j.span.innerHTML=o.join(""),this.nodeRenderStatus(a))},nodeRenderStatus:function(b){var c=b.node,d=b.tree,e=b.options,f=c.hasChildren(),g=c.isLastSibling(),h=e.aria,i=a(c.span).find(".fancytree-title"),j=e._classNames,k=[],l=c[d.statusClassPropName];l&&(k.push(j.node),d.activeNode===c&&k.push(j.active),d.focusNode===c?(k.push(j.focused),h&&i.attr("aria-activedescendant",!0)):h&&i.removeAttr("aria-activedescendant"),c.expanded?(k.push(j.expanded),h&&i.attr("aria-expanded",!0)):h&&i.removeAttr("aria-expanded"),c.folder&&k.push(j.folder),f!==!1&&k.push(j.hasChildren),g&&k.push(j.lastsib),c.lazy&&null==c.children&&k.push(j.lazy),c.partsel&&k.push(j.partsel),c.selected?(k.push(j.selected),h&&i.attr("aria-selected",!0)):h&&i.attr("aria-selected",!1),c.extraClasses&&k.push(c.extraClasses),f===!1?k.push(j.combinedExpanderPrefix+"n"+(g?"l":"")):k.push(j.combinedExpanderPrefix+(c.expanded?"e":"c")+(c.lazy&&null==c.children?"d":"")+(g?"l":"")),k.push(j.combinedIconPrefix+(c.expanded?"e":"c")+(c.folder?"f":"")),l.className=k.join(" "),c.li&&(c.li.className=g?j.lastsib:""))},nodeSetActive:function(b,c,d){d=d||{};var e,g=b.node,h=b.tree,i=b.options,j=d.noEvents===!0,m=g===h.activeNode;return c=c!==!1,m===c?k(g):c&&!j&&this._triggerNodeEvent("beforeActivate",g,b.originalEvent)===!1?l(g,["rejected"]):(c?(h.activeNode&&(f(h.activeNode!==g,"node was active (inconsistency)"),e=a.extend({},b,{node:h.activeNode}),h.nodeSetActive(e,!1),f(null===h.activeNode,"deactivate was out of sync?")),i.activeVisible&&g.makeVisible(),h.activeNode=g,h.nodeRenderStatus(b),h.nodeSetFocus(b),j||h._triggerNodeEvent("activate",g)):(f(h.activeNode===g,"node was not active (inconsistency)"),h.activeNode=null,this.nodeRenderStatus(b),j||b.tree._triggerNodeEvent("deactivate",g)),void 0)},nodeSetExpanded:function(b,c,e){e=e||{};var f,g,h,i,j,m,n=b.node,o=b.tree,p=b.options,q=e.noAnimation===!0,r=e.noEvents===!0;if(c=c!==!1,n.expanded&&c||!n.expanded&&!c)return k(n);if(c&&!n.lazy&&!n.hasChildren())return k(n);if(!c&&n.getLevel()<p.minExpandLevel)return l(n,["locked"]);if(!r&&this._triggerNodeEvent("beforeExpand",n,b.originalEvent)===!1)return l(n,["rejected"]);if(q||n.isVisible()||(q=e.noAnimation=!0),g=new a.Deferred,c&&!n.expanded&&p.autoCollapse){j=n.getParentList(!1,!0),m=p.autoCollapse;try{for(p.autoCollapse=!1,h=0,i=j.length;i>h;h++)this._callHook("nodeCollapseSiblings",j[h],e)}finally{p.autoCollapse=m}}return g.done(function(){r||b.tree._triggerNodeEvent(c?"expand":"collapse",b),p.autoScroll&&!q&&n.hasChildren()&&n.getLastChild().scrollIntoView(!0,n)}),f=function(d){var e,f,g,h;if(n.expanded=c,o._callHook("nodeRender",b,!1,!1,!0),n.ul)if(g="none"!==n.ul.style.display,h=!!n.expanded,g===h)n.warn("nodeSetExpanded: UL.style.display already set");else{if(p.fx&&!q)return e=p.fx.duration||200,f=p.fx.easing,a(n.ul).animate(p.fx,e,f,function(){d()}),void 0;n.ul.style.display=n.expanded||!parent?"":"none"}d()},c&&n.lazy&&n.hasChildren()===d?n.load().done(function(){g.notifyWith&&g.notifyWith(n,["loaded"]),f(function(){g.resolveWith(n)})}).fail(function(a){f(function(){g.rejectWith(n,["load failed ("+a+")"])})}):f(function(){g.resolveWith(n)}),g.promise()},nodeSetFocus:function(b,c){var d,e=b.tree,f=b.node;if(c=c!==!1,e.focusNode){if(e.focusNode===f&&c)return;d=a.extend({},b,{node:e.focusNode}),e.focusNode=null,this._triggerNodeEvent("blur",d),this._callHook("nodeRenderStatus",d)}c&&(this.hasFocus()||(f.debug("nodeSetFocus: forcing container focus"),this._callHook("treeSetFocus",b,!0,!0)),f.makeVisible(),e.focusNode=f,this._triggerNodeEvent("focus",b),b.options.autoScroll&&f.scrollIntoView(),this._callHook("nodeRenderStatus",b))},nodeSetSelected:function(a,b){var c=a.node,d=a.tree,e=a.options;if(b=b!==!1,c.debug("nodeSetSelected("+b+")",a),!c.unselectable){if(c.selected&&b||!c.selected&&!b)return!!c.selected;if(this._triggerNodeEvent("beforeSelect",c,a.originalEvent)===!1)return!!c.selected;b&&1===e.selectMode?d.lastSelectedNode&&d.lastSelectedNode.setSelected(!1):3===e.selectMode&&(c.selected=b,c.fixSelection3AfterClick()),c.selected=b,this.nodeRenderStatus(a),d.lastSelectedNode=b?c:null,d._triggerNodeEvent("select",a)}},nodeSetStatus:function(b,c,d,e){function f(){var a=h.children?h.children[0]:null;if(a&&a.isStatusNode()){try{h.ul&&(h.ul.removeChild(a.li),a.li=null)}catch(b){}1===h.children.length?h.children=[]:h.children.shift()}}function g(b,c){var d=h.children?h.children[0]:null;return d&&d.isStatusNode()?(a.extend(d,b),i._callHook("nodeRender",d)):(b.key="_statusNode",h._setChildren([b]),h.children[0].statusNodeType=c,i.render()),h.children[0]
}var h=b.node,i=b.tree,j=b.options._classNames;switch(c){case"ok":f(),a(h.span).removeClass(j.loading),a(h.span).removeClass(j.error);break;case"loading":a(h.span).removeClass(j.error),a(h.span).addClass(j.loading),h.parent||g({title:i.options.strings.loading+(d?" ("+d+") ":""),tooltip:e,extraClasses:"fancytree-statusnode-wait"},c);break;case"error":a(h.span).removeClass(j.loading),a(h.span).addClass(j.error),g({title:i.options.strings.loadError+(d?" ("+d+") ":""),tooltip:e,extraClasses:"fancytree-statusnode-error"},c);break;default:a.error("invalid status "+c)}},nodeToggleExpanded:function(a){return this.nodeSetExpanded(a,!a.node.expanded)},nodeToggleSelected:function(a){return this.nodeSetSelected(a,!a.node.selected)},treeClear:function(a){var b=a.tree;b.activeNode=null,b.focusNode=null,b.$div.find(">ul.fancytree-container").empty(),b.rootNode.children=null},treeCreate:function(){},treeDestroy:function(){},treeInit:function(a){this.treeLoad(a)},treeLoad:function(b,c){var d,f,g,h=b.tree,i=b.widget.element,j=a.extend({},b,{node:this.rootNode});if(h.rootNode.children&&this.treeClear(b),c=c||this.options.source)"string"==typeof c&&e();else switch(d=i.data("type")||"html"){case"html":f=i.find(">ul:first"),f.addClass("ui-fancytree-source ui-helper-hidden"),c=a.ui.fancytree.parseHtml(f);break;case"json":c=a.parseJSON(i.text()),c.children&&(c.title&&(h.title=c.title),c=c.children);break;default:a.error("Invalid data-type: "+d)}return g=this.nodeLoadChildren(j,c).done(function(){h.render(),3===b.options.selectMode&&h.rootNode.fixSelection3FromEndNodes(),h._triggerTreeEvent("init",!0)}).fail(function(){h.render(),h._triggerTreeEvent("init",!1)})},treeRegisterNode:function(){},treeSetFocus:function(a,b){b=b!==!1,b!==this.hasFocus()&&(this._hasFocus=b,this.$container.toggleClass("fancytree-treefocus",b),this._triggerTreeEvent(b?"focusTree":"blurTree"))}}),a.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&#8230;",loadError:"Load error!"},tabbable:!0,titlesTabbable:!1,_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",partsel:"fancytree-partsel",lastsib:"fancytree-lastsib",loading:"fancytree-loading",error:"fancytree-error"},lazyLoad:null,postProcess:null},_create:function(){this.tree=new p(this),this.$source=this.source||"json"===this.element.data("type")?this.element:this.element.find(">ul:first");var b,c,e,g=this.options.extensions,h=this.tree;for(e=0;e<g.length;e++)c=g[e],b=a.ui.fancytree._extensions[c],b||a.error("Could not apply extension '"+c+"' (it is not registered, did you forget to include it?)"),this.tree.options[c]=a.extend(!0,{},b.options,this.tree.options[c]),f(this.tree.ext[c]===d,"Extension name must not exist as Fancytree.ext attribute: '"+c+"'"),this.tree.ext[c]={},j(this.tree,h,b,c),h=b;this.tree._callHook("treeCreate",this.tree)},_init:function(){this.tree._callHook("treeInit",this.tree),this._bind()},_setOption:function(b,c){var d=!0,e=!1;switch(b){case"aria":case"checkbox":case"icons":case"minExpandLevel":case"tabbable":this.tree._callHook("treeCreate",this.tree),e=!0;break;case"source":d=!1,this.tree._callHook("treeLoad",this.tree,c)}this.tree.debug("set option "+b+"="+c+" <"+typeof c+">"),d&&a.Widget.prototype._setOption.apply(this,arguments),e&&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"),a.Widget.prototype.destroy.call(this)},_unbind:function(){var b=this.tree._ns;this.element.unbind(b),this.tree.$container.unbind(b),a(c).unbind(b)},_bind:function(){var a=this,b=this.options,c=this.tree,d=c._ns;this._unbind(),c.$container.on("focusin"+d+" focusout"+d,function(a){var b=r.getNode(a),d="focusin"===a.type;b?c._callHook("nodeSetFocus",b,d):c._callHook("treeSetFocus",c,d)}).on("selectstart"+d,"span.fancytree-title",function(a){a.preventDefault()}).on("keydown"+d,function(a){if(b.disabled||b.keyboard===!1)return!0;var d,e=c.focusNode,f=c._makeHookContext(e||c,a),g=c.phase;try{return c.phase="userEvent",d=e?c._triggerNodeEvent("keydown",e,a):c._triggerTreeEvent("keydown",a),"preventNav"===d?d=!0:d!==!1&&(d=c._callHook("nodeKeydown",f)),d}finally{c.phase=g}}).on("click"+d+" dblclick"+d,function(c){if(b.disabled)return!0;var d,e=r.getEventTarget(c),f=e.node,g=a.tree,h=g.phase;if(!f)return!0;d=g._makeHookContext(f,c);try{switch(g.phase="userEvent",c.type){case"click":return d.targetType=e.type,g._triggerNodeEvent("click",d,c)===!1?!1:g._callHook("nodeClick",d);case"dblclick":return d.targetType=e.type,g._triggerNodeEvent("dblclick",d,c)===!1?!1:g._callHook("nodeDblclick",d)}}finally{g.phase=h}})},getActiveNode:function(){return this.tree.activeNode},getNodeByKey:function(a){return this.tree.getNodeByKey(a)},getRootNode:function(){return this.tree.rootNode},getTree:function(){return this.tree}}),r=a.ui.fancytree,a.extend(a.ui.fancytree,{version:"2.0.0-9",buildType:"production",debugLevel:1,_nextId:1,_nextNodeKey:1,_extensions:{},_FancytreeClass:p,_FancytreeNodeClass:o,jquerySupports:{positionMyOfs:h(a.ui.version,1,9)},assert:function(a,b){return f(a,b)},debug:function(){a.ui.fancytree.debugLevel>=2&&g("log",arguments)},error:function(){g("error",arguments)},escapeHtml:function(a){return(""+a).replace(/[&<>"'\/]/g,function(a){return s[a]})},unescapeHtml:function(a){var b=c.createElement("div");return b.innerHTML=a,0===b.childNodes.length?"":b.childNodes[0].nodeValue},getEventTargetType:function(a){return this.getEventTarget(a).type},getEventTarget:function(a){var b=a&&a.target?a.target.className:"",c={node:this.getNode(a.target),type:d};return/\bfancytree-title\b/.test(b)?c.type="title":/\bfancytree-expander\b/.test(b)?c.type=c.node.hasChildren()===!1?"prefix":"expander":/\bfancytree-checkbox\b/.test(b)||/\bfancytree-radio\b/.test(b)?c.type="checkbox":/\bfancytree-icon\b/.test(b)?c.type="icon":/\bfancytree-node\b/.test(b)&&(c.type="title"),c},getNode:function(a){if(a instanceof o)return a;for(a.selector!==d?a=a[0]:a.originalEvent!==d&&(a=a.target);a;){if(a.ftnode)return a.ftnode;a=a.parentNode}return null},info:function(){a.ui.fancytree.debugLevel>=1&&g("info",arguments)},parseHtml:function(b){var c,e,f,g,h,i,j,k=b.find(">li"),l=[];return k.each(function(){var k,m,n=a(this),o=n.find(">span:first",this),p=o.length?null:n.find(">a:first"),q={tooltip:null,data:{}};for(o.length?q.title=o.html():p&&p.length?(q.title=p.html(),q.data.href=p.attr("href"),q.data.target=p.attr("target"),q.tooltip=p.attr("title")):(q.title=n.html(),g=q.title.search(/<ul/i),g>=0&&(q.title=q.title.substring(0,g))),q.title=a.trim(q.title),e=0,f=t.length;f>e;e++)q[t[e]]=d;for(i=this.className.split(" "),c=[],e=0,f=i.length;f>e;e++)j=i[e],u[j]?q[j]=!0:c.push(j);q.extraClasses=c.join(" "),h=n.attr("title"),h&&(q.tooltip=h),h=n.attr("id"),h&&(q.key=h),k=n.data(),k&&!a.isEmptyObject(k)&&(m=k.json,delete k.json,a.extend(q.data,k),m&&a.extend(q.data,m)),b=n.find(">ul:first"),q.children=b.length?a.ui.fancytree.parseHtml(b):q.lazy?d:null,l.push(q)}),l},registerExtension:function(b){f(null!=b.name,"extensions must have a `name` property."),f(null!=b.version,"extensions must have a `version` property."),a.ui.fancytree._extensions[b.name]=b},warn:function(){g("warn",arguments)}})}(jQuery,window,document),function(a){"use strict";a.ui.fancytree._FancytreeClass.prototype.countSelected=function(a){var b=this;return b.options,b.getSelectedNodes(a).length},a.ui.fancytree._FancytreeNodeClass.prototype.toUpper=function(){var a=this;return a.setTitle(a.title.toUpperCase())},a.ui.fancytree.prototype.widgetMethod1=function(a){return this.tree,a},a.ui.fancytree.registerExtension({name:"childcounter",version:"1.0.0",options:{deep:!0,hideZeros:!0,hideExpanded:!1},foo:42,_appendCounter:function(){},treeInit:function(a){a.options,a.options.childcounter,this._super(a),this.$container.addClass("fancytree-ext-childcounter")},treeDestroy:function(a){this._super(a)},nodeRenderTitle:function(b,c){var d=b.node,e=b.options.childcounter,f=d.countChildren(e.deep);this._super(b,c),!f&&e.hideZeros||d.isExpanded()&&e.hideExpanded||a("span.fancytree-icon",d.span).append(a("<span class='fancytree-childcounter'/>").text(f))},nodeSetExpanded:function(a,b,c){var d=a.tree;return a.node,this._super(a,b,c).always(function(){d.nodeRenderTitle(a)})}})}(jQuery),function(a,b,c,d){"use strict";function e(a){return 0===a?"":a>0?"+"+a:""+a}function f(b){var c=b.options.dnd||null;c&&g(),c&&c.dragStart&&b.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(b){var c=a.ui.fancytree.getNode(b.target);return c?c.tree.ext.dnd._onDragEvent("helper",c,null,b,null,null):"<div>ERROR?: helper requested but sourceNode not found</div>"},start:function(a,b){var c=b.helper.data("ftSourceNode");return!!c}}),c&&c.dragDrop&&b.widget.element.droppable({addClasses:!1,tolerance:"intersect",greedy:!1})}function g(){i||(a.ui.plugin.add("draggable","connectToFancytree",{start:function(b,c){var d=a(this).data("ui-draggable")||a(this).data("draggable"),e=c.helper.data("ftSourceNode")||null;return e?(d.offset.click.top=-2,d.offset.click.left=16,e.tree.ext.dnd._onDragEvent("start",e,null,b,c,d)):void 0},drag:function(b,c){var d,e=a(this).data("ui-draggable")||a(this).data("draggable"),f=c.helper.data("ftSourceNode")||null,g=c.helper.data("ftTargetNode")||null,i=a.ui.fancytree.getNode(b.target);return b.target&&!i&&(d=a(b.target).closest("div.fancytree-drag-helper,#fancytree-drop-marker").length>0)?(h("Drag event over helper: ignored."),void 0):(c.helper.data("ftTargetNode",i),g&&g!==i&&g.tree.ext.dnd._onDragEvent("leave",g,f,b,c,e),i&&i.tree.options.dnd.dragDrop&&(i===g?i.tree.ext.dnd._onDragEvent("over",i,f,b,c,e):i.tree.ext.dnd._onDragEvent("enter",i,f,b,c,e)),void 0)},stop:function(b,c){var d=a(this).data("ui-draggable")||a(this).data("draggable"),e=c.helper.data("ftSourceNode")||null,f=c.helper.data("ftTargetNode")||null,g=b.type,i="mouseup"===g&&1===b.which;i||h("Drag was cancelled"),f&&(i&&f.tree.ext.dnd._onDragEvent("drop",f,e,b,c,d),f.tree.ext.dnd._onDragEvent("leave",f,e,b,c,d)),e&&e.tree.ext.dnd._onDragEvent("stop",e,null,b,c,d)}}),i=!0)}var h=a.ui.fancytree.debug,i=!1;a.ui.fancytree.registerExtension({name:"dnd",version:"0.1.0",options:{dragStart:null,dragStop:null,autoExpandMS:1e3,preventVoidMoves:!0,preventRecursiveMoves:!0,dragEnter:null,dragOver:null,dragDrop:null,dragLeave:null},treeInit:function(a){var b=a.tree;this._super(a),f(b)},nodeKeydown:function(b){var c=b.originalEvent;return c.which===a.ui.keyCode.ESCAPE&&this._local._cancelDrag(),this._super(b)},_setDndStatus:function(b,c,d,f,g){var h,i=0,j="center",k=this._local,l=b?a(b.span):null,m=a(c.span);if(k.$dropMarker||(k.$dropMarker=a("<div id='fancytree-drop-marker'></div>").hide().css({"z-index":1e3}).prependTo(a(this.$div).parent())),"after"===f||"before"===f||"over"===f){switch(f){case"before":k.$dropMarker.removeClass("fancytree-drop-after fancytree-drop-over"),k.$dropMarker.addClass("fancytree-drop-before"),j="top";break;case"after":k.$dropMarker.removeClass("fancytree-drop-before fancytree-drop-over"),k.$dropMarker.addClass("fancytree-drop-after"),j="bottom";break;default:k.$dropMarker.removeClass("fancytree-drop-after fancytree-drop-before"),k.$dropMarker.addClass("fancytree-drop-over"),m.addClass("fancytree-drop-target"),i=8}h=a.ui.fancytree.jquerySupports.positionMyOfs?{my:"left"+e(i)+" center",at:"left "+j,of:m}:{my:"left center",at:"left "+j,of:m,offset:""+i+" 0"},k.$dropMarker.show().position(h)}else m.removeClass("fancytree-drop-target"),k.$dropMarker.hide();"after"===f?m.addClass("fancytree-drop-after"):m.removeClass("fancytree-drop-after"),"before"===f?m.addClass("fancytree-drop-before"):m.removeClass("fancytree-drop-before"),g===!0?(l&&l.addClass("fancytree-drop-accept"),m.addClass("fancytree-drop-accept"),d.addClass("fancytree-drop-accept")):(l&&l.removeClass("fancytree-drop-accept"),m.removeClass("fancytree-drop-accept"),d.removeClass("fancytree-drop-accept")),g===!1?(l&&l.addClass("fancytree-drop-reject"),m.addClass("fancytree-drop-reject"),d.addClass("fancytree-drop-reject")):(l&&l.removeClass("fancytree-drop-reject"),m.removeClass("fancytree-drop-reject"),d.removeClass("fancytree-drop-reject"))},_onDragEvent:function(b,c,e,f,g,i){"over"!==b&&h("tree.ext.dnd._onDragEvent(%s, %o, %o) - %o",b,c,e,this);var j,k,l,m,n,o,p,q=this.options,r=q.dnd,s=this._makeHookContext(c,f,{otherNode:e,ui:g,draggable:i}),t=null,u=a(c.span);switch(b){case"helper":j=a("<div class='fancytree-drag-helper'><span class='fancytree-drag-helper-img' /></div>").append(u.find("span.fancytree-title").clone()),a("ul.fancytree-container",c.tree.$div).append(j),j.data("ftSourceNode",c),t=j;break;case"start":c.isStatusNode()?t=!1:r.dragStart&&(t=r.dragStart(c,s)),t===!1?(this.debug("tree.dragStart() cancelled"),g.helper.trigger("mouseup"),g.helper.hide()):u.addClass("fancytree-drag-source");break;case"enter":p=r.preventRecursiveMoves&&c.isDescendantOf(e)?!1:r.dragEnter?r.dragEnter(c,s):null,t=p?a.isArray(p)?{over:a.inArray("over",p)>=0,before:a.inArray("before",p)>=0,after:a.inArray("after",p)>=0}:{over:p===!0||"over"===p,before:p===!0||"before"===p,after:p===!0||"after"===p}:!1,g.helper.data("enterResponse",t),h("helper.enterResponse: %o",t);break;case"over":n=g.helper.data("enterResponse"),o=null,n===!1||("string"==typeof n?o=n:(k=u.offset(),l={x:f.pageX-k.left,y:f.pageY-k.top},m={x:l.x/u.width(),y:l.y/u.height()},n.after&&m.y>.75?o="after":!n.over&&n.after&&m.y>.5?o="after":n.before&&m.y<=.25?o="before":!n.over&&n.before&&m.y<=.5?o="before":n.over&&(o="over"),r.preventVoidMoves&&(c===e?(h(" drop over source node prevented"),o=null):"before"===o&&e&&c===e.getNextSibling()?(h(" drop after source node prevented"),o=null):"after"===o&&e&&c===e.getPrevSibling()?(h(" drop before source node prevented"),o=null):"over"===o&&e&&e.parent===c&&e.isLastSibling()&&(h(" drop last child over own parent prevented"),o=null)),g.helper.data("hitMode",o))),"over"===o&&r.autoExpandMS&&c.hasChildren()!==!1&&!c.expanded&&c.scheduleAction("expand",r.autoExpandMS),o&&r.dragOver&&(s.hitMode=o,t=r.dragOver(c,s)),this._local._setDndStatus(e,c,g.helper,o,t!==!1&&null!==o);break;case"drop":o=g.helper.data("hitMode"),o&&r.dragDrop&&(s.hitMode=o,r.dragDrop(c,s));break;case"leave":c.scheduleAction("cancel"),g.helper.data("enterResponse",null),g.helper.data("hitMode",null),this._local._setDndStatus(e,c,g.helper,"out",d),r.dragLeave&&r.dragLeave(c,s);break;case"stop":u.removeClass("fancytree-drag-source"),r.dragStop&&r.dragStop(c,s);break;default:throw"Unsupported drag event: "+b}return t},_cancelDrag:function(){var b=a.ui.ddmanager.current;b&&b.cancel()}})}(jQuery,window,document),function(a,b,c){"use strict";var d=/Mac/.test(navigator.platform),e=a.ui.fancytree.escapeHtml,f=a.ui.fancytree.unescapeHtml;a.ui.fancytree._FancytreeNodeClass.prototype.editStart=function(){var b,d=this,e=this.tree,g=e.ext.edit,h=d.title,i=e.options.edit,j=a(".fancytree-title",d.span),k={node:d,tree:e,options:e.options};return i.beforeEdit.call(d,{type:"beforeEdit"},k)===!1?!1:(h=d.title,d.debug("editStart"),e.widget._unbind(),a(c).on("mousedown.fancytree-edit",function(b){a(b.target).hasClass("fancytree-edit-input")||d.editEnd(!0,b)}),b=a("<input />",{"class":"fancytree-edit-input",value:f(h)}),null!=i.adjustWidthOfs&&b.width(j.width()+i.adjustWidthOfs),null!=i.inputCss&&b.css(i.inputCss),k.input=b,j.html(b),a.ui.fancytree.assert(!g.currentNode,"recursive edit"),g.currentNode=this,b.focus().change(function(){b.addClass("fancytree-edit-dirty")}).keydown(function(b){switch(b.which){case a.ui.keyCode.ESCAPE:d.editEnd(!1,b);break;case a.ui.keyCode.ENTER:return d.editEnd(!0,b),!1}}).blur(function(a){return d.editEnd(!0,a)}),i.edit.call(d,{type:"edit"},k),void 0)},a.ui.fancytree._FancytreeNodeClass.prototype.editEnd=function(b,d){var f=this,g=this.tree,h=g.ext.edit,i=g.options.edit,j=a(".fancytree-title",f.span),k=j.find("input.fancytree-edit-input"),l=k.val(),m=k.hasClass("fancytree-edit-dirty"),n=(b||m&&b!==!1)&&l!==f.title,o={node:f,tree:g,options:g.options,originalEvent:d,dirty:m,save:n,input:k,value:l};return i.beforeClose.call(f,{type:"beforeClose"},o)===!1?!1:n&&i.save.call(f,{type:"save"},o)===!1?!1:(k.removeClass("fancytree-edit-dirty").unbind(),a(c).off(".fancytree-edit"),n?f.setTitle(e(l)):f.renderTitle(),g.widget._bind(),h.currentNode=null,f.setFocus(),a(g.$container).focus(),o.input=null,i.close.call(f,{type:"close"},o),!0)},a.ui.fancytree._FancytreeNodeClass.prototype.startEdit=function(){return this.warn("FancytreeNode.startEdit() is deprecated since 2014-01-04. Use .editStart() instead."),this.editStart.apply(this,arguments)},a.ui.fancytree._FancytreeNodeClass.prototype.endEdit=function(){return this.warn("FancytreeNode.endEdit() is deprecated since 2014-01-04. Use .editEnd() instead."),this.editEnd.apply(this,arguments)},a.ui.fancytree._FancytreeClass.prototype.isEditing=function(){return this.ext.edit.currentNode},a.ui.fancytree._FancytreeNodeClass.prototype.isEditing=function(){return this.tree.ext.edit.currentNode===this},a.ui.fancytree.registerExtension({name:"edit",version:"0.1.0",options:{adjustWidthOfs:4,inputCss:{minWidth:"3em"},triggerCancel:["esc","tab","click"],triggerStart:["f2","shift+click","mac+enter"],beforeClose:a.noop,beforeEdit:a.noop,close:a.noop,edit:a.noop,save:a.noop},currentNode:null,treeInit:function(a){this._super(a),this.$container.addClass("fancytree-ext-edit")},nodeClick:function(b){return a.inArray("shift+click",b.options.edit.triggerStart)>=0&&b.originalEvent.shiftKey?(b.node.editStart(),!1):(this._super(b),void 0)},nodeDblclick:function(b){return a.inArray("dblclick",b.options.edit.triggerStart)>=0?(b.node.editStart(),!1):this._super(b)},nodeKeydown:function(b){switch(b.originalEvent.which){case 113:if(a.inArray("f2",b.options.edit.triggerStart)>=0)return b.node.editStart(),!1;break;case a.ui.keyCode.ENTER:if(a.inArray("mac+enter",b.options.edit.triggerStart)>=0&&d)return b.node.editStart(),!1}return this._super(b)}})}(jQuery,window,document),function(a){"use strict";function b(a){return(a+"").replace(/([.?*+\^\$\[\]\\(){}|-])/g,"\\$1")}a.ui.fancytree._FancytreeClass.prototype.applyFilter=function(a){var c,d,e=0,f=this.options.filter.leavesOnly;return"string"==typeof a&&(c=b(a),d=new RegExp(".*"+c+".*","i"),a=function(a){return!!d.exec(a.title)}),this.enableFilter=!0,this.$div.addClass("fancytree-ext-filter"),"hide"===this.options.filter.mode?this.$div.addClass("fancytree-ext-filter-hide"):this.$div.addClass("fancytree-ext-filter-dimm"),this.visit(function(a){a.hide=!0,delete a.match,delete a.subMatch}),this.visit(function(b){f&&null!=b.children||!a(b)||(e++,b.hide=!1,b.match=!0,b.visitParents(function(a){a.hide=!1,a.subMatch=!0}))}),this.render(),e},a.ui.fancytree._FancytreeClass.prototype.clearFilter=function(){this.visit(function(a){delete a.hide,delete a.match,delete a.subMatch}),this.enableFilter=!1,this.$div.removeClass("fancytree-ext-filter fancytree-ext-filter-dimm fancytree-ext-filter-hide"),this.render()},a.ui.fancytree.registerExtension({name:"filter",version:"0.0.2",options:{mode:"dimm",leavesOnly:!1},treeInit:function(a){this._super(a)},treeDestroy:function(a){this._super(a)},nodeRenderStatus:function(b){var c,d=b.node,e=b.tree,f=a(d[e.statusClassPropName]);return c=this._super(b),f.length?e.enableFilter?(f.toggleClass("fancytree-match",!!d.match),f.toggleClass("fancytree-submatch",!!d.subMatch),f.toggleClass("fancytree-hide",!!d.hide),c):c:c}})}(jQuery,window,document),function(a){"use strict";function b(a,b){return a.map[b]}a.ui.fancytree.registerExtension({name:"glyph",version:"0.0.2",options:{prefix:"icon-",extra:null,map:{doc:"icon-file-alt",docOpen:"icon-file-alt",checkbox:"icon-check-empty",checkboxSelected:"icon-check",checkboxUnknown:"icon-check icon-muted",error:"icon-exclamation-sign",expanderClosed:"icon-caret-right",expanderLazy:"icon-angle-right",expanderOpen:"icon-caret-down",folder:"icon-folder-close-alt",folderOpen:"icon-folder-open-alt",loading:"icon-refresh icon-spin"},icon:null},treeInit:function(a){var b=a.tree;this._super(a),b.$container.addClass("fancytree-ext-glyph")},nodeRenderStatus:function(c){var d,e,f=c.node,g=c.options.glyph,h=g.map;this._super(c),f.isRoot()||(e=a("span.fancytree-expander",f.span).get(0),e&&(d=f.isLoading()?"loading":f.expanded?"expanderOpen":f.isUndefined()?"expanderLazy":"expanderClosed",e.className="fancytree-expander "+h[d]),e=a("span.fancytree-checkbox",f.span).get(0),e&&(d=f.selected?"checkboxSelected":f.partsel?"checkboxUnknown":"checkbox",e.className="fancytree-checkbox "+h[d]),e=a("span.fancytree-icon",f.span).get(0),e&&(d=f.folder?f.expanded?b(g,"folderOpen"):b(g,"folder"):f.expanded?b(g,"docOpen"):b(g,"doc"),e.className="fancytree-icon "+d))},nodeSetStatus:function(c,d,e,f){var g,h=c.options.glyph,i=c.node;this._super(c,d,e,f),g=i.parent?a("span.fancytree-expander",i.span).get(0):a(".fancytree-statusnode-wait, .fancytree-statusnode-error",i[this.nodeContainerAttrName]).find("span.fancytree-expander").get(0),"loading"===d?g.className="fancytree-expander "+b(h,"loading"):"error"===d&&(g.className="fancytree-expander "+b(h,"error"))}})}(jQuery,window,document),function(a){"use strict";function b(a,b){var d=a.closest("td");switch(b){case c.LEFT:return d.prev();case c.RIGHT:return d.next();case c.UP:return d.parent().prevAll(":visible").first().find("td").eq(d.index());case c.DOWN:return d.parent().nextAll(":visible").first().find("td").eq(d.index())}return null}var c=a.ui.keyCode,d={text:[c.UP,c.DOWN],checkbox:[c.UP,c.DOWN,c.LEFT,c.RIGHT],radiobutton:[c.UP,c.DOWN,c.LEFT,c.RIGHT],"select-one":[c.LEFT,c.RIGHT],"select-multiple":[c.LEFT,c.RIGHT]};a.ui.fancytree.registerExtension({name:"gridnav",version:"0.0.1",options:{autofocusInput:!1,handleCursorKeys:!0},treeInit:function(b){this._requireExtension("table",!0,!0),this._super(b),this.$container.addClass("fancytree-ext-gridnav"),this.$container.on("focusin",function(c){var d,e=a.ui.fancytree.getNode(c.target);e&&!e.isActive()&&(d=b.tree._makeHookContext(e,c),b.tree._callHook("nodeSetActive",d,!0))})},nodeSetActive:function(b,c){var d,e=b.options.gridnav,f=b.node,g=b.originalEvent||{},h=a(g.target).is(":input");c=c!==!1,this._super(b,c),c&&(b.options.titlesTabbable?(h||(a(f.span).find("span.fancytree-title").focus(),f.setFocus()),b.tree.$container.attr("tabindex","-1")):e.autofocusInput&&!h&&(d=a(f.tr||f.span),d.find(":input:enabled:first").focus()))},nodeKeydown:function(c){var e,f,g,h=c.options.gridnav,i=c.originalEvent,j=a(i.target);return e=j.is(":input:enabled")?j.prop("type"):null,c.tree.debug("ext-gridnav nodeKeydown",i,e),e&&h.handleCursorKeys?(f=d[e],f&&a.inArray(i.which,f)>=0&&(g=b(j,i.which),g&&g.length)?(g.find(":input:enabled").focus(),!1):!0):(c.tree.debug("ext-gridnav NOT HANDLED",i,e),this._super(c))}})}(jQuery,window,document),function(a,b,c,d){"use strict";function e(b,c){c=c||"",b||a.error("Assertion failed "+c)}function f(b,c,d,e,g){var i,j,k,l,m=!1,n=[],o=[];for(d=d||[],g=g||a.Deferred(),i=0,k=d.length;k>i;i++)j=d[i],l=b.getNodeByKey(j),l?e&&l.isUndefined()?(m=!0,b.debug("_loadLazyNodes: "+l+" is lazy: loading..."),"expand"===e?n.push(l.setExpanded()):n.push(l.load())):(b.debug("_loadLazyNodes: "+l+" already loaded."),l.setExpanded()):(o.push(j),b.debug("_loadLazyNodes: "+l+" was not yet found."));return a.when.apply(a,n).always(function(){if(m&&o.length>0)f(b,c,o,e,g);else{if(o.length)for(b.warn("_loadLazyNodes: could not load those keys: ",o),i=0,k=o.length;k>i;i++)j=d[i],c._setKey(h,d[i],!1);g.resolve()}}),g}var g="active",h="expanded",i="focus",j="selected";a.ui.fancytree._FancytreeClass.prototype.clearCookies=function(b){var c=this.ext.persist,d=c.cookiePrefix;b=b||"active expanded focus selected",b.indexOf(g)>=0&&a.removeCookie(d+g),b.indexOf(h)>=0&&a.removeCookie(d+h),b.indexOf(i)>=0&&a.removeCookie(d+i),b.indexOf(j)>=0&&a.removeCookie(d+j)},a.ui.fancytree._FancytreeClass.prototype.getPersistData=function(){var b=this.ext.persist,c=this.options.persist,d=c.cookieDelimiter,e={};e[g]=a.cookie(b.cookiePrefix+g),e[h]=(a.cookie(b.cookiePrefix+h)||"").split(d),e[j]=(a.cookie(b.cookiePrefix+j)||"").split(d),e[i]=a.cookie(b.cookiePrefix+i)},a.ui.fancytree.registerExtension({name:"persist",version:"0.2.0",options:{cookieDelimiter:"~",cookiePrefix:d,cookie:{raw:!1,expires:"",path:"",domain:"",secure:!1},expandLazy:!1,overrideSource:!1,types:"active expanded focus selected"},_setKey:function(b,c,d){c=""+c;var e=this._local,f=this.options.persist,g=e.cookiePrefix+b,h=a.cookie(g),i=h?h.split(f.cookieDelimiter):[],j=a.inArray(c,i);j>=0&&i.splice(j,1),d&&i.push(c),a.cookie(g,i.join(f.cookieDelimiter),f.cookie)},treeInit:function(b){var k=b.tree,l=b.options,m=this._local,n=this.options.persist;e(a.cookie,"Missing required plugin for 'persist' extension: jquery.cookie.js"),m.cookiePrefix=n.cookiePrefix||"fancytree-"+k._id+"-",m.storeActive=n.types.indexOf(g)>=0,m.storeExpanded=n.types.indexOf(h)>=0,m.storeSelected=n.types.indexOf(j)>=0,m.storeFocus=n.types.indexOf(i)>=0,k.$div.bind("fancytreeinit",function(){var b,e,o,p,q,r=a.cookie(m.cookiePrefix+i);k.debug("COOKIE "+c.cookie),b=a.cookie(m.cookiePrefix+h),p=b&&b.split(n.cookieDelimiter),e=m.storeExpanded?f(k,m,p,n.expandLazy?"expand":!1,null):(new a.Deferred).resolve(),e.done(function(){if(m.storeSelected&&(b=a.cookie(m.cookiePrefix+j)))for(p=b.split(n.cookieDelimiter),o=0;o<p.length;o++)q=k.getNodeByKey(p[o]),q?(q.selected===d||n.overrideSource&&q.selected===!1)&&(q.selected=!0,q.renderStatus()):m._setKey(j,p[o],!1);m.storeActive&&(b=a.cookie(m.cookiePrefix+g),!b||!l.persist.overrideSource&&k.activeNode||(q=k.getNodeByKey(b),q&&q.setActive())),m.storeFocus&&r&&(q=k.getNodeByKey(r),q&&q.setFocus())})}),this._super(b)},nodeSetActive:function(b,c,d){var e=this._local,f=this.options.persist;c=c!==!1,this._super(b,c,d),e.storeActive&&a.cookie(e.cookiePrefix+g,this.activeNode?this.activeNode.key:null,f.cookie)},nodeSetExpanded:function(a,b,c){var d,e=a.node,f=this._local;return b=b!==!1,d=this._super(a,b,c),f.storeExpanded&&f._setKey(h,e.key,b),d},nodeSetFocus:function(b){var c=this._local,d=this.options.persist;this._super(b),c.storeFocus&&a.cookie(c.cookiePrefix+i,this.focusNode?this.focusNode.key:null,d.cookie)},nodeSetSelected:function(a,b){var c=a.node,d=this._local;b=b!==!1,this._super(a,b),d.storeSelected&&d._setKey(j,c.key,b)}})}(jQuery,window,document),function(a,b,c){"use strict";function d(b,c){c=c||"",b||a.error("Assertion failed "+c)}function e(a,b){a.parentNode.insertBefore(b,a.nextSibling)}function f(a,b){a.visit(function(a){var c=a.tr;return c&&(c.style.display=a.hide||!b?"none":""),a.expanded?void 0:"skip"})}function g(b){var c,e,f,g=b.parent,h=g?g.children:null;if(h&&h.length>1&&h[0]!==b)for(c=a.inArray(b,h),f=h[c-1],d(f.tr);f.children&&(e=f.children[f.children.length-1],e.tr);)f=e;else f=g;return f}a.ui.fancytree.registerExtension({name:"table",version:"0.1.0",options:{indentation:16,nodeColumnIdx:0,checkboxColumnIdx:null},treeInit:function(b){var d,e,f,g=b.tree,h=g.widget.element;for(h.addClass("fancytree-container fancytree-ext-table"),g.tbody=h.find("> tbody")[0],g.columnCount=a("thead >tr >th",h).length,a(g.tbody).empty(),g.rowFragment=c.createDocumentFragment(),e=a("<tr />"),f="",b.options.aria&&(e.attr("role","row"),f=" role='gridcell'"),d=0;d<g.columnCount;d++)b.options.table.nodeColumnIdx===d?e.append("<td"+f+"><span class='fancytree-node' /></td>"):e.append("<td"+f+" />");g.rowFragment.appendChild(e.get(0)),g.statusClassPropName="tr",g.ariaPropName="tr",this.nodeContainerAttrName="tr",this._super(b),a(g.rootNode.ul).remove(),g.rootNode.ul=null,g.$container=h,this.$container.attr("tabindex",this.options.tabbable?"0":"-1"),this.options.aria&&g.$container.attr("role","treegrid").attr("aria-readonly",!0)},nodeRemoveChildMarkup:function(b){var c=b.node;c.visit(function(b){b.tr&&(a(b.tr).remove(),b.tr=null)})},nodeRemoveMarkup:function(b){var c=b.node;c.tr&&(a(c.tr).remove(),c.tr=null),this.nodeRemoveChildMarkup(b)},nodeRender:function(b,c,h,i,j){var k,l,m,n,o,p,q,r,s=b.tree,t=b.node,u=b.options,v=!t.parent;if(j||(b.hasCollapsedParents=t.parent&&!t.parent.expanded),!v)if(t.tr)c?this.nodeRenderTitle(b):this.nodeRenderStatus(b);else{if(b.hasCollapsedParents)return t.debug("nodeRender ignored due to unrendered parent"),void 0;o=s.rowFragment.firstChild.cloneNode(!0),p=g(t),d(p),i===!0&&j?o.style.display="none":h&&b.hasCollapsedParents&&(o.style.display="none"),p.tr?e(p.tr,o):(d(!p.parent,"prev. row must have a tr, or is system root"),s.tbody.appendChild(o)),t.tr=o,t.key&&u.generateIds&&(t.tr.id=u.idPrefix+t.key),t.tr.ftnode=t,u.aria&&a(t.tr).attr("aria-labelledby","ftal_"+t.key),t.span=a("span.fancytree-node",t.tr).get(0),this.nodeRenderTitle(b),u.createNode&&u.createNode.call(s,{type:"createNode"},b)}if(u.renderNode&&u.renderNode.call(s,{type:"renderNode"},b),k=t.children,k&&(v||h||t.expanded))for(m=0,n=k.length;n>m;m++)r=a.extend({},b,{node:k[m]}),r.hasCollapsedParents=r.hasCollapsedParents||!t.expanded,this.nodeRender(r,c,h,i,!0);k&&!j&&(q=t.tr||null,l=s.tbody.firstChild,t.visit(function(a){if(a.tr){if(a.parent.expanded||"none"===a.tr.style.display||(a.tr.style.display="none",f(a,!1)),a.tr.previousSibling!==q){t.debug("_fixOrder: mismatch at node: "+a);var b=q?q.nextSibling:l;s.tbody.insertBefore(a.tr,b)}q=a.tr}}))},nodeRenderTitle:function(b){var c,d=b.node,e=b.options;this._super(b),e.checkbox&&null!=e.table.checkboxColumnIdx&&(c=a("span.fancytree-checkbox",d.span).detach(),a(d.tr).find("td:first").html(c)),d.isRoot()||this.nodeRenderStatus(b),e.renderColumns&&e.renderColumns.call(b.tree,{type:"renderColumns"},b)},nodeRenderStatus:function(b){var c,d=b.node,e=b.options;this._super(b),a(d.tr).removeClass("fancytree-node"),c=(d.getLevel()-1)*e.table.indentation,a(d.span).css({marginLeft:c+"px"})},nodeSetExpanded:function(a,b,c){return this._super(a,b,c).always(function(){b=b!==!1,f(a.node,b)})},nodeSetStatus:function(b,c,d,e){if("ok"===c){var f=b.node,g=f.children?f.children[0]:null;g&&g.isStatusNode()&&a(g.tr).remove()}this._super(b,c,d,e)},treeClear:function(a){return this.nodeRemoveChildMarkup(this._makeHookContext(this.rootNode)),this._super(a)}})}(jQuery,window,document),function(a){"use strict";a.ui.fancytree.registerExtension({name:"themeroller",version:"0.0.1",options:{activeClass:"ui-state-active",foccusClass:"ui-state-focus",hoverClass:"ui-state-hover",selectedClass:"ui-state-highlight"},treeInit:function(b){this._super(b);var c=b.widget.element;"TABLE"===c[0].nodeName?(c.addClass("ui-widget ui-corner-all"),c.find(">thead tr").addClass("ui-widget-header"),c.find(">tbody").addClass("ui-widget-conent")):c.addClass("ui-widget ui-widget-content ui-corner-all"),c.delegate(".fancytree-node","mouseenter mouseleave",function(b){var c=a.ui.fancytree.getNode(b.target),d="mouseenter"===b.type;c.debug("hover: "+d),a(c.span).toggleClass("ui-state-hover ui-corner-all",d)})},treeDestroy:function(a){this._super(a),a.widget.element.removeClass("ui-widget ui-widget-content ui-corner-all")},nodeRenderStatus:function(b){var c=b.node,d=a(c.span);this._super(b),d.toggleClass("ui-state-active",c.isActive()),d.toggleClass("ui-state-focus",c.hasFocus()),d.toggleClass("ui-state-highlight",c.isSelected())}})}(jQuery,window,document);
//# sourceMappingURL=jquery.fancytree-all.min.js.map
\ No newline at end of file
......@@ -20,6 +20,20 @@ String.prototype.trim = function () {
return this.replace(/^\s*/, "").replace(/\s*$/, "");
};
String.prototype.hashCode = function(){
if (Array.prototype.reduce){
return this.split("").reduce(function(a,b){a=((a<<5)-a)+b.charCodeAt(0);return a&a},0);
}
var hash = 0;
if (this.length === 0) return hash;
for (var i = 0; i < this.length; i++) {
var character = this.charCodeAt(i);
hash = ((hash<<5)-hash)+character;
hash = hash & hash; // Convert to 32bit integer
}
return hash;
}
/****************************************/
function setInput($elt) {
"use strict";
......
......@@ -156,7 +156,7 @@ function updateStatus(elt, val) {
$(src).addClass(value);
switch (val) {
case "waiting":
$(src).children('p').text("Waiting for starting");
$(src).children('p').text("Queue");
break;
case "stopped":
$(src).children('p').text("Stopped by user");
......
......@@ -7,9 +7,13 @@ $(document).ready(function () {
"use strict";
var viewer,
editor,
modelist,
config,
files,
working_node = null,
editorlist = Array(),
editorIndex = 0,
saveTimeOut = null,
softwareDisplay = true,
projectDir = $("input#project").val(),
workdir = $("input#workdir").val(),
......@@ -19,61 +23,315 @@ $(document).ready(function () {
ajaxResult = false,
clipboardNode = null,
pasteMode = null,
selection = "",
edit_status = "",
current_file = null,
favourite_list = new Array(),
beforeunload_warning_set = false,
editorWidth = $("#code").css("width"),
beforeunload_warning_set = 0,
base_path = function () {
return softwareDisplay ? currentProject : 'runner_workdir/';
return softwareDisplay ? currentProject : 'workspace/';
};
var MAX_TABITITLE_WIDTH = 126;
var TAB_EXTRA_WIDTH = 25;
var MIN_TABITEM_WIDTH = 61; //The minimum size of tabItem
var MAX_TAB_NUMBER = 10; //The maximum number of tab that could be opened
function alertStatus (jqXHR) {
if (jqXHR.status == 404) {
$("#error").Popup("Requested page not found. [404]", {type: 'error'});
} else if (jqXHR.status == 500) {
$("#error").Popup("Internal Error. Cannot respond to your request, please check your parameters", {type: 'error'});
} else {
$("#error").Popup("An Error occured: \n" + jqXHR.responseText, {type: 'error'});
}
}
// Open File in a new Tab and return status
function openFile(file) {
if (send) {
return;
var status = false;
if (file.substr(-1) === "/" || send) {
return false;
}
send = true;
edit = false;
if (file.substr(-1) !== "/") {
var info = $("#edit_info").html();
$("#edit_info").empty();
$("#edit_info").append("LOADING FILE... <img src='"+$SCRIPT_ROOT+"/static/images/loading.gif' />");
var hash = addTab (file, true);
if (hash === "") {
return false;
}
var activeSpan = getActiveTabTitleSelector(hash);
$(activeSpan).html('Loading file...');
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/getFileContent',
data: {file: file},
success: function (data) {
var name, start, path = file;
data: {file: file}
})
.done(function(data) {
var editor = editorlist[hash].editor;
if (data.code === 1) {
$("#edit_info").empty();
name = file.split('/');
if (file.length > 75) {
//substring title.
start = file.length - 75;
path = "..." + file.substring(file.indexOf("/", (start + 1)));
}
$("#edit_info").append(" " + path);
editor.getSession().setValue(data.result);
$(activeSpan).html(file.replace(/^.*(\\|\/|\:)/, ''));
var mode = modelist.getModeForPath(file);
editor.getSession().modeName = mode.name;
editor.getSession().setMode(mode.mode);
beforeunload_warning_set = false;
editorlist[hash].busy = false;
status = true;
} else {
$("#error").Popup("Unable to open file: " + file + "<br/>" + data.result,
{type: 'error', duration: 5000});
//Close current tab
$("#tabControl div[rel='" + hash + "'] span.bt_close").click();
}
})
.fail(function(jqXHR, exception) {
alertStatus (jqXHR);
//Close current tab
$("#tabControl div[rel='" + hash + "'] span.bt_close").click();
})
.always(function() {
// always
});
return status;
}
function runSaveFile(hash){
if ( !editorlist[hash].changed ) {
return;
}
if (editorlist[hash].busy) {
return;
}
editorlist[hash].busy = true;
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/saveFileContent',
data: {
file: editorlist[hash].path,
content: editorlist[hash].editor.getSession().getValue()
}})
.done(function(data) {
if (data.code === 1) {
var currentSpan = getActiveTabTitleSelector(hash),
title = $(currentSpan).html();
editorlist[hash].changed = false;
$(currentSpan).html(title.substr(1));
if(--beforeunload_warning_set === 0) {
window.onbeforeunload = function() { return; };
edit = true;
current_file = file;
$("span#edit_status").html("");
edit_status = "";
setCookie("EDIT_CURRENT_FILE", file);
}
} else {
$("#error").Popup(data.result, {type: 'error', duration: 5000});
$("#edit_info").html(info);
}
send = false;
})
.fail(function(jqXHR, exception) {
alertStatus (jqXHR);
})
.always(function() {
editorlist[hash].busy = false;
});
}
/******* MANAGE TAB CONTROL *****/
function getTabList () {
var list = [];
for (var x in editorlist) {
list.push(editorlist[x].path);
}
return list;
}
function saveTabList () {
if (saveTimeOut) clearTimeout(saveTimeOut);
saveTimeOut = setTimeout(function () {
setCookie("OPENED_TAB_LIST", getTabList().join("#"));
}, 2000);
}
function getMaxTab () {
var tabBarWidth = $(".box_header").width() - $(".box_header ul").width();
var max = (tabBarWidth - (tabBarWidth % MIN_TABITEM_WIDTH))/MIN_TABITEM_WIDTH;
return ( max > MAX_TAB_NUMBER ) ? MAX_TAB_NUMBER : max;
}
//Reduce TabItem title to have the minimal or maximal width
function resizeTabItems (addTab) {
var numberTab = $("#tabControl div.item").length;
var width = 0;
if (addTab) {
numberTab++;
}
if (numberTab == 0) {
return width;
}
var tabBarWidth = $(".box_header").width() - $(".box_header ul").width();
var rest = tabBarWidth % numberTab;
var averageWidth = ( tabBarWidth - rest )/numberTab;
if (averageWidth > MIN_TABITEM_WIDTH) {
averageWidth -= TAB_EXTRA_WIDTH;
width = averageWidth + rest;
if (averageWidth > MAX_TABITITLE_WIDTH) {
averageWidth = MAX_TABITITLE_WIDTH;
width = averageWidth;
}
$("#tabControl div.item span:nth-child(1)").each(function () {
$(this).css('width', averageWidth);
});
if ( !addTab && (rest !== 0) ) {
$("#tabControl div.item:last-child span:nth-child(1)").each(function () {
$(this).css('width', width);
});
}
return;
}
return width;
}
//Add new tabItem
function addTab (path, selected) {
var hash = path.hashCode() + '';
if (editorlist.hasOwnProperty(hash)) {
//this file already exist in editor. Select file and exit!
$("#tabControl div.item").each( function () {
var rel = $(this).attr('rel');
if ( rel && (rel === hash) ) {
$(this).click();
return "";
}
});
return "";
}
var title = path.replace(/^.*(\\|\/|\:)/, '');
var numberTab = $("#tabControl div.item").length;
if ( numberTab >= getMaxTab() ) {
$("#error").Popup("Sorry! We cannot add more item, please close unused tab",
{type: 'info', duration: 5000});
return "";
}
var width = resizeTabItems(true);
var tab = '<div class="item" rel="' + hash
+ '"><span style="width: '+ width +'px" '
+ 'title="' + path + '">' + title + '</span>'
+ '<span class="bt_close" title="Close this tab">×</span></div>';
var editorhtml = '<pre class="editor" id="editor' + (++editorIndex)
+ '" rel="' + hash + '"></pre>';
//Add Elements
$("#tabControl").append(tab);
$("#tabContent").append(editorhtml);
addEditor(path, hash, 'editor'+editorIndex);
/* Change selected tab*/
$("#tabControl div.item:last").click(function () {
var rel = $(this).attr('rel'), current;
if ( $(this).hasClass('active') ) {
editorlist[rel].editor.focus();
return false;
}
current = $("#tabContent pre.active").attr('rel');
if (current && current !== undefined) {
editorlist[current].isOpened = false;
}
$("#tabControl div.active").removeClass('active');
$("#tabContent pre.active").removeClass('active');
$(this).addClass('active');
$("#tabContent pre[rel='" + rel + "']").addClass('active');
editorlist[rel].isOpened = true;
editorlist[rel].editor.resize();
editorlist[rel].editor.focus();
return false;
});
/*Close Selected Tab*/
$("#tabControl div.item:last span.bt_close").click(function () {
var $tab = $(this).parent(), position = 0,
active = $tab.hasClass('active');
var rel = $tab.attr('rel');
if (editorlist[ rel ].changed) {
if (!window.confirm("You have unsaved changes. Your changes will be lost if you don't save them")){
return false;
}
if(--beforeunload_warning_set === 0) {
window.onbeforeunload = function() { return; };
}
}
//Remove tab
position = ($tab.index() === 0) ? 1 : $tab.index();
editorlist[ rel ].editor.destroy();
delete editorlist[ rel ];
$tab.remove();
$("#tabContent pre[rel='" + rel + "']").remove();
if ( active && $("#tabControl div.item").length > 0 ) {
$("#tabControl div.item:nth-child("+position+")").click();
}
resizeTabItems ();
saveTabList ();
return false;
});
if (selected) {
$("#tabControl div.item:last").click();
}
return hash;
}
function addEditor (path, hash, id) {
var editor = ace.edit(id);
//Init Ace editor!!
editor.setTheme("ace/theme/crimson_editor");
editor.getSession().setMode("ace/mode/text");
editor.getSession().setTabSize(2);
editor.getSession().setUseSoftTabs(true);
editor.renderer.setHScrollBarAlwaysVisible(false);
editorlist[hash] = {editor: editor, changed: false, path: path,
isOpened: false, busy: true};
editor.on("change", function (e) {
var activeToken = getActiveToken(),
activeSpan = getActiveTabTitleSelector();
if (!editorlist[activeToken].busy && !editorlist[activeToken].changed) {
editorlist[activeToken].changed = true;
$(activeSpan).html("*" + $(activeSpan).html());
if(beforeunload_warning_set === 0) {
window.onbeforeunload = function() { return "You have unsaved changes. Your changes will be lost if you don't save them"; };
}
beforeunload_warning_set++;
}
});
editor.commands.addCommand({
name: 'SaveText',
bindKey: {win: 'Ctrl-S', mac: 'Command-S'},
exec: function(editor) {
$("#save").click();
},
readOnly: false // false if this command should not apply in readOnly mode
});
editor.commands.addCommand({
name: 'Fullscreen',
bindKey: {win: 'Ctrl-E', mac: 'Command-E'},
exec: function(editor) {
$("#fullscreen").click();
}
});
}
function getCurrentEditor () {
var hash = $("#tabContent pre.active").attr('rel');
if ( editorlist.hasOwnProperty(hash) ) {
return editorlist[hash].editor;
}
else { return null }
}
function getActiveToken () {
return $("#tabContent pre.active").attr('rel');
}
function getActiveTabTitleSelector (hash) {
var rel = (hash) ? hash : $("#tabContent pre.active").attr('rel');
if ( editorlist.hasOwnProperty(rel) ) {
return "#tabControl div[rel='" + rel + "'] span:nth-child(1)";
}
else { return ""; }
}
/****** END ******/
function switchContent() {
if (!softwareDisplay) {
......@@ -89,7 +347,6 @@ $(document).ready(function () {
}
$("#info").empty();
$("#info").append("Current work tree: " + base_path());
selection = "";
clipboardNode = null;
pasteMode = null;
}
......@@ -122,9 +379,10 @@ $(document).ready(function () {
if (developList === null || developList.length <= 0) {
return;
}
var editor = getCurrentEditor();
editor.navigateFileStart();
editor.find('buildout', {caseSensitive: true, wholeWord: true});
if (!editor.getSelectionRange().isEmpty()) {
if (!getCurrentEditor().getSelectionRange().isEmpty()) {
//editor.find("",{caseSensitive: true,wholeWord: true,regExp: true});
//if (!editor.getSelectionRange().isEmpty()) {
//alert("found");
......@@ -132,7 +390,8 @@ $(document).ready(function () {
//else{alert("no found");
//}
} else {
$("#error").Popup("Can not found part [buildout]! Please make sure that you have a cfg file", {type: 'alert', duration: 3000});
$("#error").Popup("Can not found part [buildout]! Please make sure that you have a cfg file",
{type: 'alert', duration: 3000});
return;
}
editor.navigateLineEnd();
......@@ -142,7 +401,7 @@ $(document).ready(function () {
result = data.result.split('#');
editor.insert("\ndevelop =\n\t" + result[0] + "\n");
for (i = 1; i < result.length; i += 1) {
editor.insert("\t" + result[i] + "\n");
getCurrentEditor().insert("\t" + result[i] + "\n");
}
}
})
......@@ -153,6 +412,7 @@ $(document).ready(function () {
$("#option").click();
}
/***** FILE TREE MANAGEMENT ******/
// --- Implement Cut/Copy/Paste --------------------------------------------
function copyPaste(action, node) {
......@@ -172,10 +432,14 @@ $(document).ready(function () {
files: clipboardNode.data.path,
dir: node.data.path
};
// Copy mode: prevent duplicate keys:
var request, cb = clipboardNode.toDict(true, function(dict){
delete dict.key; // Remove key, so a new one will be created
});
cb.data.path = node.data.path + '/' + clipboardNode.title;
if( pasteMode == "cut" ) {
// Cut mode: check for recursion and remove source
dataForSend.opt = 7;
var cb = clipboardNode.toDict(true);
if( node.isDescendantOf(clipboardNode) ) {
$("#error").Popup("ERROR: Cannot move a node to it's sub node.", {type: 'error', duration: 5000});
return;
......@@ -188,10 +452,11 @@ $(document).ready(function () {
node.render();
}
else{
node.lazyLoad()
node.load(true);
}
clipboardNode.remove();
}
clipboardNode = pasteMode = null;
});
} else {
if (node.key === clipboardNode.getParent().key){
......@@ -203,12 +468,8 @@ $(document).ready(function () {
request = fileBrowserOp(dataForSend);
request.always(function() {
if (ajaxResult){
// Copy mode: prevent duplicate keys:
var cb = clipboardNode.toDict(true, function(dict){
delete dict.key; // Remove key, so a new one will be created
});
if (dataForSend.opt === 14){
node.lazyLoad(true);
node.load(true);
node.toggleExpanded();
}
else if (node.isExpanded()){
......@@ -216,9 +477,9 @@ $(document).ready(function () {
node.render();
}
}
clipboardNode = pasteMode = null;
});
}
clipboardNode = pasteMode = null;
break;
}
};
......@@ -232,10 +493,10 @@ $(document).ready(function () {
node.setFocus();
node.setActive();
if (srcElement.hasClass('fancytree-folder')){
menu.disableContextMenuItems("#edit,#editfull,#view,#md5sum,#favorite");
menu.disableContextMenuItems("#edit,#view,#md5sum,#favorite");
}
else{
menu.disableContextMenuItems("#nfile,#nfolder,#refresh,#paste");
menu.disableContextMenuItems("#nfile,#nfolder,#refresh,#paste,#ufile");
}
return true;
}
......@@ -257,13 +518,7 @@ $(document).ready(function () {
}
})
.fail(function(jqXHR, exception) {
if (jqXHR.status == 404) {
$("#error").Popup("Requested page not found. [404]", {type: 'error'});
} else if (jqXHR.status == 500) {
$("#error").Popup("Internal Error. Cannot respond to your request, please check your parameters", {type: 'error'});
} else {
$("#error").Popup("An Error occured: \n" + jqXHR.responseText, {type: 'error'});
}
alertStatus (jqXHR);
})
.always(function() {
//return result;
......@@ -286,7 +541,8 @@ $(document).ready(function () {
case "paste":
copyPaste(action, node);
break;
case "edit": openFile(node.data.path); break;
case "edit": openFile(node.data.path);
saveTabList (); break;
case "view":
$.colorbox.remove();
$.ajax({
......@@ -313,16 +569,11 @@ $(document).ready(function () {
}
});
break;
case "editfull":
var url = $SCRIPT_ROOT+"/editFile?profile="+encodeURIComponent(node.data.path)+"&filename="+encodeURIComponent(node.title);
window.open(url, '_blank');
window.focus();
break;
case "md5sum":
getmd5sum(node.data.path);
break;
case "refresh":
node.lazyLoad(true);
node.load(true);
node.toggleExpanded();
break;
case "nfolder":
......@@ -338,7 +589,7 @@ $(document).ready(function () {
request = fileBrowserOp(dataForSend)
request.always(function() {
if (ajaxResult){
node.lazyLoad(true);
node.load(true);
node.toggleExpanded();
}
});
......@@ -356,7 +607,7 @@ $(document).ready(function () {
request = fileBrowserOp(dataForSend)
request.always(function() {
if (ajaxResult){
node.lazyLoad(true);
node.load(true);
node.toggleExpanded();
}
});
......@@ -391,10 +642,18 @@ $(document).ready(function () {
request = fileBrowserOp(dataForSend);
request.always(function() {
if (ajaxResult){
var copy = node.toDict(true, function(dict){
dict.title = newName;
});
node.applyPatch(copy);
if (node.getParent().isRoot()) {
if ($('#fileTreeFull').css('display') === 'none'){
$('#fileTree').fancytree("getTree").reload();
}
else {
$('#fileTreeFull').fancytree("getTree").reload();
}
}
else {
node.getParent().load(true);
node.toggleExpanded();
}
}
});
......@@ -402,6 +661,16 @@ $(document).ready(function () {
case "favorite":
addToFavourite(node.data.path);
break;
case "ufile":
$.colorbox.remove();
$("#uploadForm input[name=dir]").val(node.data.path);
$("#inlineUpload").colorbox({inline:true,
width: "480px", height: "200px", onComplete:function(){
//nothing
}});
$("#inlineUpload").click();
working_node = node;
break;
default:
return;
}
......@@ -427,6 +696,7 @@ $(document).ready(function () {
dblclick: function(event, data) {
if (!data.node.isFolder()){
openFile(data.node.data.path);
saveTabList ();
}
},
source: {
......@@ -434,7 +704,7 @@ $(document).ready(function () {
data:{opt: 20, dir: path, key: key, listfiles: 'yes'},
cache: false
},
lazyload: function(event, data) {
lazyLoad: function(event, data) {
var node = data.node;
data.result = {
url: $SCRIPT_ROOT + "/fileBrowser",
......@@ -490,10 +760,13 @@ $(document).ready(function () {
});
}
/******* END ******/
function openOnFavourite($elt){
var index = parseInt($elt.attr('rel')),
file = favourite_list[index];
openFile(file);
saveTabList ();
$("#filelist").click();
}
......@@ -522,9 +795,12 @@ $(document).ready(function () {
function initEditor(){
var tmp, filename;
current_file = getCookie("EDIT_CURRENT_FILE");
if (current_file) {
openFile(current_file);
var strList = getCookie("OPENED_TAB_LIST"), tabList;
if (strList) {
tabList = strList.split("#");
for (var i=0; i< tabList.length; i++) {
openFile(tabList[i]);
}
}
tmp = getCookie("FAV_FILE_LIST");
if(tmp){
......@@ -550,6 +826,7 @@ $(document).ready(function () {
removeFavourite($(this));
return false;
});
saveTabList ();
}
function addToFavourite(filepath){
......@@ -585,20 +862,10 @@ $(document).ready(function () {
}
/************ INITIALIZE FUNTIONS CALLS ************************/
editor = ace.edit("editor");
modelist = require("ace/ext/modelist");
ace.require("ace/ext/language_tools");
config = require("ace/config");
editor.setOptions({ enableBasicAutocompletion: true, enableSnippets: true });
editor.setTheme("ace/theme/crimson_editor");
editor.getSession().setMode("ace/mode/text");
editor.getSession().setTabSize(2);
editor.getSession().setUseSoftTabs(true);
editor.renderer.setHScrollBarAlwaysVisible(false);
initTree('#fileTree', currentProject, 'pfolder');
initTree('#fileTreeFull', 'runner_workdir');
//bindContextMenu('#fileTree');
......@@ -609,61 +876,39 @@ $(document).ready(function () {
$("#option").Tooltip();
$("#filelist").Tooltip();
editor.on("change", function (e) {
if (edit_status === "" && edit) {
$("span#edit_status").html("*");
}
if (!beforeunload_warning_set) {
window.onbeforeunload = function() { return "You have unsaved changes"; };
beforeunload_warning_set = true;
$("#save").click(function () {
if ($("#tabControl div.item").length === 0) {
return false;
}
var hash = getActiveToken();
runSaveFile(hash);
return false;
});
editor.commands.addCommand({
name: 'myCommand',
bindKey: {win: 'Ctrl-S', mac: 'Command-S'},
exec: function(editor) {
$("#save").click();
},
readOnly: false // false if this command should not apply in readOnly mode
$( "#tabControl" ).resize(function() {
resizeTabItems ();
});
editor.commands.addCommand({
name: 'Fullscreen',
bindKey: {win: 'Ctrl-E', mac: 'Command-E'},
exec: function(editor) {
$("#fullscreen").click();
$("#expand").click( function () {
var leftWith = $('#fileTree').width() + 6;
if ( $("#details_box").css("display") !== 'none' ) {
$("#details_box").hide();
$("#code").css("width", "100%");
if ( $("body").hasClass("fullScreen") ) {
$(".main_content").css('left', '0');
}
});
$("#save").click(function () {
beforeunload_warning_set = false;
window.onbeforeunload = function() { return; };
if (!edit) {
$("#error").Popup("Please select the file to edit", {type: 'alert', duration: 3000});
return false;
}
if (send) {
return false;
else {
if ( $("body").hasClass("fullScreen") ) {
$(".main_content").css('left', leftWith + 'px');
}
send = true;
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/saveFileContent',
data: {
file: current_file,
content: editor.getSession().getValue()
},
success: function (data) {
if (data.code === 1) {
$("#error").Popup("File saved succefuly!", {type: 'confirm', duration: 3000});
$("span#edit_status").html("");
} else {
$("#error").Popup(data.result, {type: 'error', duration: 5000});
$("#details_box").show();
$("#code").css("width", editorWidth);
}
send = false;
if ($("#tabControl div.item").length !== 0) {
getCurrentEditor().resize();
}
});
$("#option").click();
return false;
});
......@@ -677,23 +922,18 @@ $(document).ready(function () {
return false;
});
$("#getmd5").click(function () {
getmd5sum(current_file);
if ($("#tabControl div.item").length === 0) {
return false;
}
getmd5sum(editorlist[getActiveToken()].path);
$("#option").click();
return false;
});
$("#clearselect").click(function () {
edit = false;
$("#info").empty();
$("#info").append("Current work tree: " + base_path());
$("#edit_info").empty();
$("#edit_info").append("No file in editor");
editor.getSession().setValue("");
$("a#option").hide();
selection = "";
return false;
});
$("#adddevelop").click(function () {
if ($("#tabControl div.item").length === 0) {
return false;
}
var developList = [],
i = 0;
$("#plist li").each(function (index) {
......@@ -709,28 +949,86 @@ $(document).ready(function () {
}
return false;
});
$("a#addflist").click(function(){
addToFavourite(current_file);
$("a#addflist").click(function () {
if ($("#tabControl div.item").length === 0) {
return false;
}
addToFavourite(editorlist[getActiveToken()].path);
$("#option").click();
return false;
});
$("a#find").click(function(){
config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor)});
$("a#find").click(function () {
if ($("#tabControl div.item").length === 0) {
return false;
}
config.loadModule("ace/ext/searchbox", function(e) {
e.Search(getCurrentEditor())
});
$("#option").click();
return false;
});
$("a#replace").click(function(){
config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor, true)});
$("a#replace").click(function () {
if ($("#tabControl div.item").length === 0) {
return false;
}
config.loadModule("ace/ext/searchbox", function(e) {
e.Search(getCurrentEditor(), true)
});
$("#option").click();
return false;
});
$("#fullscreen").click(function(){
var hash = getActiveToken();
$("#fullscreen span").toggleClass("e_expanded");
$("body").toggleClass("fullScreen");
$("#editor").toggleClass("fullScreen-editor");
editor.resize();
$("#software_folder").toggleClass("fullScreen");
$(".main_content").toggleClass("fullScreen-editor");
$('#fileTree').toggleClass("fullScreen-tree");
$('#fileTreeFull').toggleClass("fullScreen-tree");
$(".main_content").css('left', '');
if ( $("#details_box").css("display") === 'none' ) {
$(".main_content").css('left', '0');
}
if ($("#tabControl div.item").length === 0) {
return false;
}
resizeTabItems ();
editorlist[hash].editor.resize();
editorlist[hash].editor.focus();
return false;
});
$('#choosefiles').on('change', function (event) {
files = event.target.files;
});
$("#submitUpload").click( function (){
jQuery('#uploadForm').submit();
$("#cboxClose").click();
return false;
});
jQuery('#uploadForm').ajaxForm({
beforeSubmit: function () {
$("#error").Popup("We are uploading your file...", {type: 'info', duration: 3000});
},
success: function (data, statusText, xhr, $form) {
if (data.indexOf("{result: '1'}") === -1) {
var msg = (data === "{result: '0'}") ? "ERROR: Please check your file or folder location!" : data;
$("#error").Popup("Error: " + msg, {type: 'error', duration: 5000});
} else {
$("#error").Popup("Your file has been uploaded!", {type: 'confirm', duration: 5000});
working_node.load(true);
}
},
error: function (xhr, ajaxOptions, thrownError) {
alertStatus (xhr);
},
dataType: 'script'
});
});
......@@ -113,7 +113,11 @@ $(document).ready(function () {
})
.always(function() {
sending = false;
if (processState === "Stopped" || processState === "Checking" || $("#manual").is(":checked")) {
$("#logheader").html(info);
} else {
$("#logheader").html("Inspecting slapgrid log - Click for more options");
}
});
}
......
......@@ -4,6 +4,7 @@
{{ super() }}
<link href="{{ url_for('static', filename='css/ui.fancytree.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" />
<link href="{{ url_for('static', filename='css/jquery.contextMenu.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" />
<link href="{{ url_for('static', filename='css/editor.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" />
<script src="{{ url_for('static', filename='js/jquery/jquery.contextMenu-custom.js') }}" type="text/javascript" charset="utf-8"></script>
<script src="{{ url_for('static', filename='js/jquery/jquery.fancytree.min.js') }}" type="text/javascript" charset="utf-8"></script>
<link href="{{ url_for('static', filename='css/colorbox.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" />
......@@ -28,8 +29,7 @@
<!-- Definition of context menu -->
<ul id="fileTreeMenu" class="contextMenu">
<li class="edit"><a href="#edit">Edit</a></li>
<li class="edit"><a href="#editfull">Open in new editor</a></li>
<li class="view"><a href="#view">Open in viewer</a></li>
<li class="view"><a href="#view">Open in popup</a></li>
<li class="rename separator"><a href="#rename">Rename</a></li>
<li class="delete "><a href="#delete">Delete</a></li>
<li class="refresh separator"><a href="#refresh">Refresh</a></li>
......@@ -40,28 +40,21 @@
<li class="paste"><a href="#paste">Paste</a></li>
<li class="newfile separator"><a href="#nfile">New File</a></li>
<li class="newdir"><a href="#nfolder">New Folder</a></li>
<li class="uploadfile"><a href="#ufile">Upload File</a></li>
</ul>
<div id="software_folder">
<div>
<ul class='box_header'>
<div class='box_header'>
<ul>
<li id="switch"><span class="swith_btn" title="Switch between differents file source">This project</span></li>
<li id="option"><span class="fmenu_btn" title='Show more option' rel='tooltip'>Menu</span></li>
<li id="filelist"><span class="flist_btn" title="Recently opened files and favourites" rel='tooltip'>&nbsp;</span></li>
<li id="save"><span class="save_btn" title="Save current file. Hint: Use Ctrl+S">Save</span></li>
<li id="fullscreen"><span class="fullscreen" title="Show Editor in Fullscreen. Hint: Use Ctrl+E"></span></li>
<li>
<h2>
<span id="edit_info">No file in editor</span>
<span id="edit_status"></span>
</h2>
</li>
<li id="filelist"><span class="flist_btn" title="Favourites files list" rel='tooltip'>&nbsp;</span></li>
<li id="fullscreen"><span class="expand_editor" title="Show Editor in Full window. Hint: Use Ctrl+E">&nbsp;</span></li>
<li id="save"><span class="save_btn" title="Save current file. Hint: Use Ctrl+S">&nbsp;</span></li>
<li id="option"><span class="fmenu_btn" title='Show more options' rel='tooltip'>Menu</span></li>
</ul>
<!--<a href="#" id="clearselect" class="lshare no-right-border" style="float:left">Clean</a>-->
<div id="tabControl"></div>
<div class="clear"></div>
</div>
<div class="clear"></div>
<div class="software_details">
<div id="details_box">
<div id="fileTree" class="file_tree_short"></div>
......@@ -70,15 +63,11 @@
</div>
<div id="code">
<div class="main_content">
<pre id="editor">
</pre>
<div id="tabContent"></div>
</div>
<!--<input type=submit value="Save" id="save" class="button">-->
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
<div id="file_info" class="file_info"><span id="info"></span></div>
</form>
......@@ -88,6 +77,9 @@
<ul class="inline">
<li><a id='getmd5' href="#">Get or Update md5sum</a></li>
<li><a id='addflist' href="#">Add to favourites</a></li>
<li><a id='expand' title="Show or Hide file tree view area." href="#">
Show or Hide FileTree</a>
</li>
<li><a id='find' href="#">Find in file &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Ctrl+F]</a></li>
<li><a id='replace' href="#">Replace in file &nbsp;&nbsp;[Ctrl+H]</a></li>
</ul>
......@@ -118,4 +110,23 @@
</div>
</div>
<a id='inlineUpload' style='display:none' href="#uploadContent">Inline HTML</a>
<div style='display:none'>
<div id="uploadContent" style="padding:10px; background:#fff;">
<h2 style="color: #4c6172; font: 18px \'Helvetica Neue\', Helvetica, Arial, sans-serif;">
Upload local file to your workspace</h2>
<p id="uploadlog" class="message"><br/></p>
<br/>
<form action="{{ url_for('fileBrowser') }}" id="uploadForm" enctype="multipart/form-data">
<div class="fileinputs">
<input type="file" name="filename" size="30" id="choosefiles" />
<input type="hidden" name="opt" value="11" />
<input type="hidden" name="dir" value="" />
<br/>
<input type=submit value="Upload" id="submitUpload" class="button" />
</div>
</form>
</div>
</div>
{% endblock %}
......@@ -11,7 +11,7 @@
{% block body %}
<h2 class="hight hide" id="logheader">Inspecting current slapgrid log - Click for more options</h2>
<h2 class="hight hide" id="logheader">Inspecting slapgrid log - Click for more options</h2>
<div class="log_btn" id="logconfigbox" style="display:none">
<span style="margin-left:15px; font-size: 18px;"> Update parameters </span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment