/* * aciTree jQuery Plugin v4.5.0-rc.7 * http://acoderinsights.ro * * Copyright (c) 2014 Dragos Ursu * Dual licensed under the MIT or GPL Version 2 licenses. * * Require jQuery Library >= v1.9.0 http://jquery.com * + aciPlugin >= v1.5.1 https://github.com/dragosu/jquery-aciPlugin */ // DOM aciPluginClass.plugins.aciTree_dom={container:function(b){var a=b.lastChild;if(a&&(a.nodeName=="UL")){return a}return null},firstChild:function(b,d){var a=this.container(b);if(a){var c=a.firstChild;if(d){while(c&&!d.call(this,c)){c=c.nextSibling}}return c}return null},lastChild:function(c,d){var a=this.container(c);if(a){var b=a.lastChild;if(d){while(b&&!d.call(this,b)){b=b.previousSibling}}return b}return null},prev:function(b,c){var a=b.previousSibling;if(c){while(a&&!c.call(this,a)){a=a.previousSibling}}return a},next:function(b,c){var a=b.nextSibling;if(c){while(a&&!c.call(this,a)){a=a.nextSibling}}return a},prevAll:function(f,h){var e,d,g,a,c,b;while(true){e=this.prev(f);if(e){if(h){a=h.call(this,e);if(a===null){f=e;continue}}d=this.lastChild(e);if(d){if(h&&(h.call(this,d)===null)){f=d;continue}c=false;while(g=this.lastChild(d)){d=g;if(h){a=h.call(this,d);if(a===null){f=d;c=true;break}}}if(c){continue}if(h){a=h.call(this,d);if(a){return d}else{if(a!==null){f=d;continue}}}else{return d}}else{if(!h||a){return e}else{f=e;continue}}}b=this.parent(f);if(b){if(h){a=h.call(this,b);if(a){return b}else{f=b}}else{return b}}else{return null}}return null},nextAll:function(d,g){var e,a,c,b,f;while(true){e=this.firstChild(d);if(e){if(g){a=g.call(this,e);if(a){return e}else{d=e;if(a!==null){continue}}}else{return e}}while(true){c=this.next(d);if(c){if(g){a=g.call(this,c);if(a){return c}else{d=c;if(a!==null){break}else{continue}}}else{return c}}else{b=d;f=null;while(b=this.parent(b)){c=this.next(b);if(c){if(g){a=g.call(this,c);if(a){return c}else{d=c;if(a!==null){f=true}else{f=false}break}}else{return c}}}if(f!==null){if(f){break}else{continue}}return null}}}return null},first:function(b,d){var a=this.container(b);if(a){var c=a.firstChild;if(c){if(d&&!d.call(this,c)){return this.nextAll(c,d)}return c}}return null},last:function(c,e){var a=this.container(c);if(a){var b=a.lastChild;if(b){if(e&&(e.call(this,b)===null)){return this.prevAll(b,e)}else{var d;while(d=this.lastChild(b)){b=d}if(e&&!e.call(this,b)){return this.prevAll(b,e)}return b}}}return null},children:function(b,f,h){var a=[],i=[],d,c,g;var e=this.firstChild(b);if(e){while(true){g=false;do{if(h){d=h.call(this,e);if(d){a.push(e)}if(f&&(d!==null)){c=this.firstChild(e);if(c){i.push(e);e=c;g=true;break}}}else{a.push(e);if(f){c=this.firstChild(e);if(c){i.push(e);e=c;g=true;break}}}}while(e=e.nextSibling);if(!g){while(e=i.pop()){e=e.nextSibling;if(e){break}}if(!e){break}}}}return a},childrenTill:function(d,g){var e=[],a,b,c;var f=d.firstChild;if(f){while(true){c=false;do{a=g.call(this,f);if(a){return f}else{if(a===null){return null}}b=f.firstChild;if(b){e.push(f);f=b;c=true;break}}while(f=f.nextSibling);if(!c){while(f=e.pop()){f=f.nextSibling;if(f){break}}if(!f){break}}}}return null},childrenByClass:function(b,a){if(b.getElementsByClassName){var c=b.getElementsByClassName(a instanceof Array?a.join(" "):a);return c?c[0]:null}else{return this.childrenTill(b,function(d){return this.hasClass(d,a)})}},parent:function(b){var a=b.parentNode.parentNode;if(a&&(a.nodeName=="LI")){return a}return null},parentFrom:function(a){while(a.nodeName!="LI"){a=a.parentNode;if(!a){return null}}return a},parentTill:function(b,c){var a;while(b=b.parentNode){a=c.call(this,b);if(a){return b}else{if(a===null){return null}}}return null},parentByClass:function(b,a){return this.parentTill(b,function(c){return this.hasClass(c,a)})},hasClass:function(e,d,a){var b=" "+e.className+" ";if(a instanceof Array){for(var c=0;c=0)&&(lt){o--;return}var v,u=false;if(ps.interval){m=t+s.delay}p--;if(o<40){o++;k()}})}}o--};var j=[];var g=function(){for(var t=0;t<4;t++){j[t]=c.setInterval(function(){if(o<20){o++;k()}},10)}};var n=function(){for(var t=0;tj.bottom-l)){return false}return true}return false},openPath:function(i,h){h=this._options(h);if(this.isItem(i)){var g=this._instance.queue;this.inodes(this.path(i),false).each(function(){var j=d(this);g.push(function(k){this.open(j,this._inner(h));k()})});g.push(function(j){this._success(i,h);j()})}else{this._fail(i,h)}},isOpenPath:function(h){var g=this.parent(h);return g[0]?this.isOpen(g)&&a.hasClass(g[0],"aciTreeVisible"):true},_speedFraction:function(i,g,j){if((jl.bottom-n){var m=o.top-l.bottom+n+j;if(!g.unanimated&&this._instance.options.view){this._instance.jQuery.stop(true).animate({scrollTop:this._instance.jQuery.scrollTop()+m},{duration:this._speedFraction(this._instance.options.view.duration,l.bottom-l.top,m),easing:this._instance.options.view.easing,complete:this.proxy(function(){this._success(h,g)})})}else{this._instance.jQuery.stop(true)[0].scrollTop=this._instance.jQuery.scrollTop()+m;this._success(h,g)}}else{this._success(h,g)}}};if(this.hasParent(h)){this.openPath(h,this._inner(g,{success:i,fail:g.fail}))}else{i.apply(this)}}else{this._fail(h,g)}},hasParent:function(g){return this.parent(g).length>0},parent:function(g){return g?d(a.parent(g[0])):d([])},topParent:function(g){return this.path(g).eq(0)},_createBranch:function(l,i){var k=0;var j=function(o){var n;for(var p=0;p=k){this._success(l,i)}});var m=this.proxy(function(o,n){if(o){a.addRemoveClass(o[0],"aciTreeInode","aciTreeInodeMaybe")}this.append(o,this._inner(i,{success:function(s,q){var p;for(var r=0;r0){var j=k[h];if(a.hasClass(j,"aciTreOdd")){i=false}k=k.slice(h+1)}}this._coreDOM.oddEven(d(k),i)},_setOddEvenChildren:function(h){var i=a.hasClass(h[0],"aciTreeOdd");var g=this.children(h);this._coreDOM.oddEven(g,!i)},_itemHook:function(h,i,g,j){if(this._instance.options.itemHook){this._instance.options.itemHook.apply(this,arguments)}},_createItem:function(h,g){if(this._private.itemClone[g]){var r=this._private.itemClone[g].cloneNode(true);var u=r.firstChild;var n=u;for(var j=0;j0},disabled:function(g){return d(a.withClass(g.toArray(),"aciTreeDisabled"))},enable:function(h,g){g=this._options(g,"enabled","enablefail","wasenabled",h);if(this.isItem(h)){if(!this._trigger(h,"beforeenable",g)){this._fail(h,g);return}if(this.isDisabled(h)){a.removeClass(h[0],"aciTreeDisabled");this._success(h,g)}else{this._notify(h,g)}}else{this._fail(h,g)}},isEnabled:function(g){return g&&!a.hasClass(g[0],"aciTreeDisabled")},isEnabledPath:function(g){return a.withClass(this.path(g).toArray(),"aciTreeDisabled").length==0},enabled:function(g){return d(a.withClass(g.toArray(),null,"aciTreeDisabled"))},hide:function(i,g){g=this._options(g,"hidden","hidefail","washidden",i);if(this.isItem(i)){if(!this._trigger(i,"beforehide",g)){this._fail(i,g);return}if(this.isHidden(i)){this._notify(i,g)}else{a.addRemoveClass(i[0],"aciTreeHidden","aciTreeVisible");a.addRemoveClass(this.children(i,true).toArray(),"aciTreeHidden","aciTreeVisible");var h=this.parent(i);this._setFirstLast(h.length?h:null,i);this._setOddEven(i);this._success(i,g)}}else{this._fail(i,g)}},isHidden:function(g){return g&&a.hasClass(g[0],"aciTreeHidden")},isHiddenPath:function(h){var g=this.parent(h);return g[0]&&a.hasClass(g[0],"aciTreeHidden")},_updateHidden:function(g){if(this.isHiddenPath(g)){if(!this.isHidden(g)){a.addClass(g[0],"aciTreeHidden");this._updateVisible(g)}}else{this._updateVisible(g)}},hidden:function(g){return d(a.withClass(g.toArray(),"aciTreeHidden"))},_showHidden:function(h){var g=null;this.path(h).add(h).each(this.proxy(function(i){var j=d(i);if(this.isHidden(j)){a.removeClass(j[0],"aciTreeHidden");if(this.isOpenPath(j)&&(!g||this.isOpen(g))){a.addClass(j[0],"aciTreeVisible")}this._setFirstLast(g,this._getFirstLast(g))}g=j},true))},show:function(i,g){g=this._options(g,"shown","showfail","wasshown",i);if(this.isItem(i)){if(!this._trigger(i,"beforeshow",g)){this._fail(i,g);return}if(this.isHidden(i)){this._showHidden(i);var h=this.topParent(i);this._setOddEven(h.length?h:i);this._success(i,g)}else{this._notify(i,g)}}else{this._fail(i,g)}},isOpen:function(g){return g&&a.hasClass(g[0],"aciTreeOpen")},isClosed:function(g){return g&&!a.hasClass(g[0],"aciTreeOpen")},hasChildren:function(g,h){return this.children(g,false,h).length>0},hasSiblings:function(g,h){return this.siblings(g,h).length>0},hasPrev:function(g,h){return this.prev(g,h).length>0},hasNext:function(g,h){return this.next(g,h).length>0},siblings:function(g,h){return g?d(a.children(g[0].parentNode.parentNode,false,function(i){return(i!=g[0])&&(h||!this.hasClass(i,"aciTreeHidden"))})):d([])},prev:function(g,h){return g?d(a.prev(g[0],h?null:function(i){return !this.hasClass(i,"aciTreeHidden")})):d([])},next:function(g,h){return g?d(a.next(g[0],h?null:function(i){return !this.hasClass(i,"aciTreeHidden")})):d([])},level:function(h){var i=-1;if(h){var g=h[0];while(a.hasClass(g,"aciTreeLi")){g=g.parentNode.parentNode;i++}}return i},getId:function(g){var h=this.itemData(g);return h?h.id:null},itemData:function(g){return g?g.data("itemData"+this._instance.nameSpace):null},setId:function(h,g){g=this._options(g,"idset","idfail","wasid",h);if(this.isItem(h)){if(!this._trigger(h,"beforeid",g)){this._fail(h,g);return}var i=this.itemData(h);g.oldId=i.id;if(g.id==g.oldId){this._notify(h,g)}else{i.id=g.id;this._success(h,g)}}else{this._fail(h,g)}},getIndex:function(j){if(j&&j[0]){if(c.Array.prototype.indexOf){return c.Array.prototype.indexOf.call(j[0].parentNode.childNodes,j[0])}else{var h=j[0].parentNode.childNodes;for(var g=0;g=j.length){j.last().after(i)}else{j.eq(g.index).before(i)}}var h=this.parent(i);this._setFirstLast(h.length?h:null,i.add([j[0],j.get(-1)]));this._setOddEven(h);this._success(i,g)}}else{this._fail(i,g)}},getLabel:function(g){var h=this.itemData(g);return h?h.label:null},isItem:function(g){return g&&a.hasClass(g[0],"aciTreeLi")},_animate:function(j,k,i,l){if(!j){j=this._instance.jQuery}if(!i){var h=k?this._instance.options.show:this._instance.options.hide;if(h){var g=a.container(j[0]);if(g){d(g).stop(true,true).animate(h.props,{duration:h.duration,easing:h.easing,complete:l?this.proxy(l):null})}else{if(l){l.apply(this)}}return}}d(a.container(j[0])).stop(true,true).toggle(k);if(l){l.apply(this)}},first:function(g,h){if(!g){g=this._instance.jQuery}return d(a.firstChild(g[0],h?null:function(i){return !this.hasClass(i,"aciTreeHidden")}))},isFirst:function(h,i){if(h){var g=a.parent(h[0]);return this.first(g?d(g):null,i)[0]==h[0]}return false},last:function(g,h){if(!g){g=this._instance.jQuery}return d(a.lastChild(g[0],h?null:function(i){return !this.hasClass(i,"aciTreeHidden")}))},isLast:function(h,i){if(h){var g=a.parent(h[0]);return this.last(g?d(g):null,i)[0]==h[0]}return false},isBusy:function(g){if(g){return a.hasClass(g[0],"aciTreeLoad")}else{return this._instance.queue.busy()}},_loading:function(g,h){if(g){a.toggleClass(g[0],"aciTreeLoad",h);if(h){g[0].firstChild.setAttribute("aria-busy",true)}else{g[0].firstChild.removeAttribute("aria-busy")}}else{if(h){this._loader(h)}}},_loader:function(g){if(g||this.isBusy()){if(!this._private.loaderInterval){this._private.loaderInterval=c.setInterval(this.proxy(function(){this._loader()}),this._instance.options.loaderDelay)}a.addClass(this._instance.jQuery[0],"aciTreeLoad");c.clearTimeout(this._private.loaderHide);this._private.loaderHide=c.setTimeout(this.proxy(function(){a.removeClass(this._instance.jQuery[0],"aciTreeLoad")}),this._instance.options.loaderDelay*2)}},isChildren:function(h,g){if(!h){h=this._instance.jQuery}return g&&(h.has(g).length>0)},isImmediateChildren:function(h,g){if(!h){h=this._instance.jQuery}return g&&h.children(".aciTreeUl").children(".aciTreeLi").is(g)},sameParent:function(i,g){if(i&&g){var j=this.parent(i);var h=this.parent(g);return(!j.length&&!h.length)||(j[0]==h[0])}return false},sameTopParent:function(i,g){if(i&&g){var j=this.topParent(i);var h=this.topParent(g);return(!j.length&&!h.length)||(j[0]==h[0])}return false},_serialize:function(g,i){var h=this.itemData(g);if(this.isInode(g)){h.inode=true;if(this.wasLoad(g)){if(h.hasOwnProperty("open")){h.open=this.isOpen(g)}else{if(this.isOpen(g)){h.open=true}}h.branch=[];this.children(g,false,true).each(this.proxy(function(j){var k=this._serialize(d(j),i);if(i){k=i.call(this,d(j),{},k)}else{k=this._instance.options.serialize.call(this,d(j),{},k)}if(k){h.branch.push(k)}},true));if(!h.branch.length){h.branch=null}}else{if(h.hasOwnProperty("open")){h.open=false}if(h.hasOwnProperty("branch")){h.branch=null}}}else{if(h.hasOwnProperty("inode")){h.inode=false}if(h.hasOwnProperty("open")){h.open=null}if(h.hasOwnProperty("branch")){h.branch=null}}if(h.hasOwnProperty("disabled")){h.disabled=this.isDisabled(g)}else{if(this.isDisabled(g)){h.disabled=true}}return h},serialize:function(g,j,k){if(typeof j=="object"){if(g){var i=this._serialize(g,k);if(k){i=k.call(this,g,{},i)}else{i=this._instance.options.serialize.call(this,g,{},i)}return i}else{var h=[];this.children(null,false,true).each(this.proxy(function(l){var m=this._serialize(d(l),k);if(k){m=k.call(this,d(l),{},m)}else{m=this._instance.options.serialize.call(this,d(l),{},m)}if(m){h.push(m)}},true));return h}}return""},destroy:function(g){g=this._options(g);if(!this.wasInit()){this._trigger(null,"notinit",g);this._fail(null,g);return}if(this.isLocked()){this._trigger(null,"locked",g);this._fail(null,g);return}if(!this._trigger(null,"beforedestroy",g)){this._trigger(null,"destroyfail",g);this._fail(null,g);return}this._private.locked=true;this._instance.jQuery.addClass("aciTreeLoad").attr("aria-busy",true);this._instance.queue.destroy();this._destroyHook(false);this.unload(null,this._inner(g,{success:this.proxy(function(){c.clearTimeout(this._private.loaderHide);c.clearInterval(this._private.loaderInterval);this._private.itemClone={};this._destroyHook(true);this._instance.jQuery.unbind(this._instance.nameSpace).off(this._instance.nameSpace,".aciTreeButton").off(this._instance.nameSpace,".aciTreeLine");this._instance.jQuery.removeClass("aciTree"+this._instance.index+" aciTreeLoad").removeAttr("role aria-busy");this._private.locked=false;this._super();this._trigger(null,"destroyed",g);this._success(null,g)}),fail:function(){this._instance.jQuery.removeClass("aciTreeLoad");this._private.locked=false;this._trigger(null,"destroyfail",g);this._fail(null,g)}}))},_destroyHook:function(g){}};aciPluginClass.plugins.aciTree=aciPluginClass.aciPluginUi.extend(e,"aciTreeCore");aciPluginClass.publish("aciTree",b);var a=aciPluginClass.plugins.aciTree_dom})(jQuery,this); // utils (function(e,d,f){var b={filterHook:function(h,g,i){return g.length?i.test(d.String(this.getLabel(h))):true}};var c={__extend:function(){e.extend(this._instance,{filter:new this._queue(this,this._instance.options.queue)});this._instance.filter.destroy();this._super()},branch:function(h,k,i){var g=this._instance.queue;var j=this.proxy(function(m,o,l){var n=l?this.next(m):this.first(m);if(n.length){if(this.isInode(n)){if(this.wasLoad(n)){g.push(function(p){o.call(this,n);j(n,o);j(n,o,true);p()})}else{if(i){this.ajaxLoad(n,{success:function(){o.call(this,n);j(n,o);j(n,o,true)},fail:function(){j(n,o,true)}})}else{g.push(function(p){o.call(this,n);j(n,o,true);p()})}}}else{g.push(function(p){o.call(this,n);j(n,o,true);p()})}}});j(h,k)},swap:function(i){i=this._options(i,null,"swapfail",null,null);var h=i.item1;var g=i.item2;if(this.isItem(h)&&this.isItem(g)&&!this.isChildren(h,g)&&!this.isChildren(g,h)&&(h[0]!=g[0])){if(!this._trigger(null,"beforeswap",i)){this._fail(null,i);return}var l=this.prev(h);if(l.length){if(g[0]==l[0]){g.before(h)}else{h.insertAfter(g);g.insertAfter(l)}}else{var k=this.next(h);if(k.length){if(g[0]==k[0]){g.after(h)}else{h.insertAfter(g);g.insertBefore(k)}}else{var j=h.parent();h.insertAfter(g);j.append(g)}}this._updateLevel(h);var j=this.parent(h);this._setFirstLast(j.length?j:null,h);this._updateHidden(h);this._updateLevel(g);j=this.parent(g);this._setFirstLast(j.length?j:null,g);this._updateHidden(g);this._setOddEven(h.add(g));this._trigger(null,"swapped",i);this._success(null,i)}else{this._fail(null,i)}},_updateItemLevel:function(n,h,k){a.addRemoveClass(n[0],"aciTreeLevel"+k,"aciTreeLevel"+h);var g=n[0].firstChild;g.setAttribute("aria-level",k+1);var m=a.childrenByClass(g,"aciTreeEntry");if(h0)&&(m!=n));o.total+=n;o.checked+=m}});var i={total:0,checked:0};g(j,i,k);var h=this.proxy(function(p,o,q){var m=this.parent(p);if(m.length){if(!o){var l=this._checkboxChildren(m);var n=this.checkboxes(l,true).length;var o=(n>0)&&(n!=l.length)}if(this.hasCheckbox(m)){if((q!==f)&&(this._instance.options.checkboxChain!==1)){this._checkboxDOM.check(m,o?true:q)}this._checkboxDOM.tristate(m,o);h(m,o,q)}else{if(this._instance.options.checkboxBreak){h(m)}else{h(m,o,q)}}}});h(j,f,k)},hasCheckbox:function(g){return g&&a.hasClass(g[0],"aciTreeCheckbox")},addCheckbox:function(h,g){g=this._options(g,"checkboxadded","addcheckboxfail","wascheckbox",h);if(this.isItem(h)){if(!this._trigger(h,"beforeaddcheckbox",g)){this._fail(h,g);return}if(this.hasCheckbox(h)){this._notify(h,g)}else{var i=function(){this._checkboxDOM.add(h,{});this._success(h,g)};if(this.extRadio&&this.hasRadio(h)){this.removeRadio(h,this._inner(g,{success:i,fail:g.fail}))}else{i.apply(this)}}}else{this._fail(h,g)}},removeCheckbox:function(h,g){g=this._options(g,"checkboxremoved","removecheckboxfail","notcheckbox",h);if(this.isItem(h)){if(!this._trigger(h,"beforeremovecheckbox",g)){this._fail(h,g);return}if(this.hasCheckbox(h)){this._checkboxDOM.remove(h);this._success(h,g)}else{this._notify(h,g)}}else{this._fail(h,g)}},isChecked:function(g){if(this.hasCheckbox(g)){return a.hasClass(g[0],"aciTreeChecked")}if(this._super){return this._super(g)}return false},check:function(h,g){if(this.extCheckbox&&this.hasCheckbox(h)){g=this._options(g,"checked","checkfail","waschecked",h);if(!this._trigger(h,"beforecheck",g)){this._fail(h,g);return}if(this.isChecked(h)){this._notify(h,g)}else{this._checkboxDOM.check(h,true);if(this._instance.options.checkboxChain!==false){this._checkboxUpdate(h,true)}this._success(h,g)}}else{if(this._super){this._super(h,g)}else{this._trigger(h,"checkfail",g);this._fail(h,g)}}},uncheck:function(h,g){if(this.extCheckbox&&this.hasCheckbox(h)){g=this._options(g,"unchecked","uncheckfail","notchecked",h);if(!this._trigger(h,"beforeuncheck",g)){this._fail(h,g);return}if(this.isChecked(h)){this._checkboxDOM.check(h,false);if(this._instance.options.checkboxChain!==false){this._checkboxUpdate(h,false)}this._success(h,g)}else{this._notify(h,g)}}else{if(this._super){this._super(h,g)}else{this._trigger(h,"uncheckfail",g);this._fail(h,g)}}},checkboxes:function(g,h){if(h!==f){return e(a.withClass(g.toArray(),h?["aciTreeCheckbox","aciTreeChecked"]:"aciTreeCheckbox",h?null:"aciTreeChecked"))}return e(a.withClass(g.toArray(),"aciTreeCheckbox"))},_serialize:function(g,i){var h=this._super(g,i);if(h&&this.extCheckbox()){if(h.hasOwnProperty("checkbox")){h.checkbox=this.hasCheckbox(g);h.checked=this.isChecked(g)}else{if(this.hasCheckbox(g)){if(this.extRadio&&this.extRadio()){h.checkbox=true}h.checked=this.isChecked(g)}}}return h},serialize:function(h,j,k){if(j=="checkbox"){var i="";var g=this.children(h,true,true);this.checkboxes(g,true).each(this.proxy(function(l){var m=e(l);if(k){i+=k.call(this,m,j,this.getId(m))}else{i+=this._instance.options.serialize.call(this,m,j,this.getId(m))}},true));return i}return this._super(h,j,k)},isTristate:function(g){return g&&a.hasClass(g[0],"aciTreeTristate")},tristate:function(g){return e(a.withClass(g.toArray(),"aciTreeTristate"))},extCheckbox:function(){return this._instance.options.checkbox},option:function(g,h){if(this.wasInit()&&!this.isLocked()){if((g=="checkbox")&&(h!=this.extCheckbox())){if(h){this._checkboxInit()}else{this._checkboxDone()}}}this._super(g,h)},_checkboxDone:function(g){this._instance.jQuery.unbind(this._private.nameSpace);this._instance.jQuery.off(this._private.nameSpace,".aciTreeItem");if(!g){this.checkboxes(this.children(null,true,true)).each(this.proxy(function(h){this.removeCheckbox(e(h))},true))}},_destroyHook:function(g){if(g){this._checkboxDone(true)}this._super(g)}};aciPluginClass.plugins.aciTree=aciPluginClass.plugins.aciTree.extend(b,"aciTreeCheckbox");aciPluginClass.defaults("aciTree",c);var a=aciPluginClass.plugins.aciTree_dom})(jQuery,this); // radio (works best with selectable) (function(e,c,f){var b={radio:false,radioChain:true,radioBreak:true,radioClick:false};var d={_radioInit:function(){this._instance.jQuery.bind("acitree"+this._private.nameSpace,function(k,i,j,g,h){switch(g){case"loaded":if(j){i._radioLoad(j)}break}}).bind("keydown"+this._private.nameSpace,this.proxy(function(h){switch(h.which){case 32:if(this.extSelectable&&this.extSelectable()&&!h.ctrlKey){var g=this.focused();if(this.hasRadio(g)&&this.isEnabled(g)){if(!this.isChecked(g)){this.check(g)}h.stopImmediatePropagation();h.preventDefault()}}break}})).on("click"+this._private.nameSpace,".aciTreeItem",this.proxy(function(h){if(!this._instance.options.radioClick||e(h.target).is(".aciTreeCheck")){var g=this.itemFrom(h.target);if(this.hasRadio(g)&&this.isEnabled(g)&&(!this.extSelectable||!this.extSelectable()||(!h.ctrlKey&&!h.shiftKey))){if(!this.isChecked(g)){this.check(g)}h.preventDefault()}}}))},_initHook:function(){if(this.extRadio()){this._radioInit()}this._super()},_itemHook:function(h,i,g,k){if(this.extRadio()){var j=this.extCheckbox&&this.hasCheckbox(i);if(!j&&(g.radio||((g.radio===f)&&(!this.extCheckbox||!this.extCheckbox())))){this._radioDOM.add(i,g)}}this._super(h,i,g,k)},_radioDOM:{add:function(k,g){a.addClass(k[0],g.checked?["aciTreeRadio","aciTreeChecked"]:"aciTreeRadio");var l=a.childrenByClass(k[0].firstChild,"aciTreeText");var j=l.parentNode;var i=c.document.createElement("LABEL");var h=c.document.createElement("SPAN");h.className="aciTreeCheck";i.appendChild(h);i.appendChild(l);j.appendChild(i);k[0].firstChild.setAttribute("aria-checked",!!g.checked)},remove:function(i){a.removeClass(i[0],["aciTreeRadio","aciTreeChecked"]);var j=a.childrenByClass(i[0].firstChild,"aciTreeText");var g=j.parentNode;var h=g.parentNode;h.replaceChild(j,g);i[0].firstChild.removeAttribute("aria-checked")},check:function(g,h){a.toggleListClass(g.toArray(),"aciTreeChecked",h,function(i){i.firstChild.setAttribute("aria-checked",h)})}},_radioLoad:function(g){if(!this._instance.options.radioChain){return}if(this.hasRadio(g)){if(this.isChecked(g)){if(!this.radios(this.children(g,false,true),true).length){this._radioUpdate(g,true)}}else{this._radioUpdate(g)}}},_radioChildren:function(h){if(this._instance.options.radioBreak){var i=[];var j=this.proxy(function(l){var k=this.children(l,false,true);k.each(this.proxy(function(m){var n=e(m);if(this.hasRadio(n)){i.push(m);j(n)}},true))});j(h);return e(i)}else{var g=this.children(h,true,true);return this.radios(g)}},_radioLevel:function(g){var h=[];g.each(this.proxy(function(j){var k=e(j);var i=this.children(k,false,true);i.each(this.proxy(function(l){var m=e(l);if(!this._instance.options.radioBreak||this.hasRadio(m)){h.push(l)}},true))},true));return e(h)},_radioUpdate:function(i,j){var k=this.proxy(function(l){var m=this.siblings(l,true);this._radioDOM.check(this.radios(m),false);m.each(this.proxy(function(n){var o=e(n);if(!this._instance.options.radioBreak||this.hasRadio(o)){this._radioDOM.check(this._radioChildren(o),false)}},true))});if(j){k(i)}var g=this.proxy(function(n){var l=this._radioLevel(n);var o=this.radios(l);if(o.length){var m=this.radios(l,true);if(m.length){m=m.first();this._radioDOM.check(m,true);k(m);g(m)}else{m=o.first();this._radioDOM.check(m,true);k(m);g(m)}}else{if(l.length){g(l)}}});if(j){g(i)}else{this._radioDOM.check(this._radioChildren(i),false)}var h=this.proxy(function(m){var l=this.parent(m);if(l.length){if(this.hasRadio(l)){if(j){k(l)}this._radioDOM.check(l,j);h(l)}else{if(!this._instance.options.radioBreak){if(j){k(l)}h(l)}}}});if(j!==f){h(i)}},hasRadio:function(g){return g&&a.hasClass(g[0],"aciTreeRadio")},addRadio:function(h,g){g=this._options(g,"radioadded","addradiofail","wasradio",h);if(this.isItem(h)){if(!this._trigger(h,"beforeaddradio",g)){this._fail(h,g);return}if(this.hasRadio(h)){this._notify(h,g)}else{var i=function(){this._radioDOM.add(h,{});this._success(h,g)};if(this.extCheckbox&&this.hasCheckbox(h)){this.removeCheckbox(h,this._inner(g,{success:i,fail:g.fail}))}else{i.apply(this)}}}else{this._fail(h,g)}},removeRadio:function(h,g){g=this._options(g,"radioremoved","removeradiofail","notradio",h);if(this.isItem(h)){if(!this._trigger(h,"beforeremoveradio",g)){this._fail(h,g);return}if(this.hasRadio(h)){this._radioDOM.remove(h);this._success(h,g)}else{this._notify(h,g)}}else{this._fail(h,g)}},isChecked:function(g){if(this.hasRadio(g)){return a.hasClass(g[0],"aciTreeChecked")}if(this._super){return this._super(g)}return false},check:function(h,g){if(this.extRadio&&this.hasRadio(h)){g=this._options(g,"checked","checkfail","waschecked",h);if(!this._trigger(h,"beforecheck",g)){this._fail(h,g);return}if(this.isChecked(h)){this._notify(h,g)}else{this._radioDOM.check(h,true);if(this._instance.options.radioChain){this._radioUpdate(h,true)}this._success(h,g)}}else{if(this._super){this._super(h,g)}else{this._trigger(h,"checkfail",g);this._fail(h,g)}}},uncheck:function(h,g){if(this.extRadio&&this.hasRadio(h)){g=this._options(g,"unchecked","uncheckfail","notchecked",h);if(!this._trigger(h,"beforeuncheck",g)){this._fail(h,g);return}if(this.isChecked(h)){this._radioDOM.check(h,false);if(this._instance.options.radioChain){this._radioUpdate(h,false)}this._success(h,g)}else{this._notify(h,g)}}else{if(this._super){this._super(h,g)}else{this._trigger(h,"uncheckfail",g);this._fail(h,g)}}},radios:function(g,h){if(h!==f){return e(a.withClass(g.toArray(),h?["aciTreeRadio","aciTreeChecked"]:"aciTreeRadio",h?null:"aciTreeChecked"))}return e(a.withClass(g.toArray(),"aciTreeRadio"))},_serialize:function(g,i){var h=this._super(g,i);if(h&&this.extRadio()){if(h.hasOwnProperty("radio")){h.radio=this.hasRadio(g);h.checked=this.isChecked(g)}else{if(this.hasRadio(g)){if(this.extCheckbox&&this.extCheckbox()){h.radio=true}h.checked=this.isChecked(g)}}}return h},serialize:function(h,j,k){if(j=="radio"){var i="";var g=this.children(h,true,true);this.radios(g,true).each(this.proxy(function(l){var m=e(l);if(k){i+=k.call(this,m,j,this.getId(m))}else{i+=this._instance.options.serialize.call(this,m,j,this.getId(m))}},true));return i}return this._super(h,j,k)},extRadio:function(){return this._instance.options.radio},option:function(g,h){if(this.wasInit()&&!this.isLocked()){if((g=="radio")&&(h!=this.extRadio())){if(h){this._radioInit()}else{this._radioDone()}}}this._super(g,h)},_radioDone:function(g){this._instance.jQuery.unbind(this._private.nameSpace);this._instance.jQuery.off(this._private.nameSpace,".aciTreeItem");if(!g){this.radios(this.children(null,true,true)).each(this.proxy(function(h){this.removeRadio(e(h))},true))}},_destroyHook:function(g){if(g){this._radioDone(true)}this._super(g)}};aciPluginClass.plugins.aciTree=aciPluginClass.plugins.aciTree.extend(d,"aciTreeRadio");aciPluginClass.defaults("aciTree",b);var a=aciPluginClass.plugins.aciTree_dom})(jQuery,this); // column (function(e,c,f){var b={columnData:[]};var d={__extend:function(){e.extend(this._private,{propsIndex:{}});this._super()},_initHook:function(){if(this._instance.options.columnData.length){var j=false,h;for(var g in this._instance.options.columnData){h=this._instance.options.columnData[g];if(h.width!==f){this._updateCss(".aciTree.aciTree"+this._instance.index+" .aciTreeColumn"+g,"width:"+h.width+"px;");j=true}this._private.propsIndex[h.props]=g}if(j){this._updateWidth()}}this._super()},_getCss:function(m,p,o){var h="_getCss_"+c.String(m).replace(/[^a-z0-9_-]/ig,"_");var l=e("body").find("#"+h);if(!l.length){if(m instanceof Array){var g="",j="";for(var k in m){g+='
';j+="
"}g+=j}else{var g='
'}e("body").append('
'+g+"
");l=e("body").find("#"+h)}var n=l.find("*:last").css(p);if(o){n=parseInt(n);if(isNaN(n)){n=null}}return n},_updateCss:function(i,g){var k="_updateCss_"+c.String(i).replace(">","_gt_").replace(/[^a-z0-9_-]/ig,"_");var h='";var j=e("body").find("#"+k);if(j.length){j.replaceWith(h)}else{e("body").prepend(h)}},getWidth:function(g){if((g>=0)&&(g=0)&&(g=0)&&(g=0)&&(h=0)&&(g.index=0)&&(gthis._instance.options.editDelay)&&(i');g.find("label").attr("for","aciTree-editable-tree-item");this._editableDOM.get(h).val(this.getLabel(h))},remove:function(i,h){var g=i.removeClass("aciTreeEdited").children(".aciTreeLine");g.find(".aciTreeText").html(this.getLabel(i));g.find("label").removeAttr("for")},get:function(g){return g?g.children(".aciTreeLine").find("input[type=text]"):d([])}},edited:function(){return this._instance.jQuery.find(".aciTreeEdited")},isEdited:function(g){return g&&a.hasClass(g[0],"aciTreeEdited")},_focusEdit:function(h){var i=this._editableDOM.get(h).focus().trigger("click")[0];if(i){if(typeof i.selectionStart=="number"){i.selectionStart=i.selectionEnd=i.value.length}else{if(i.createTextRange!==f){var g=i.createTextRange();g.collapse(false);g.select()}}}},setLabel:function(h,g){if(!this.extEditable()||!this.isEdited(h)){this._super(h,g)}},edit:function(h,g){g=this._options(g,"edit","editfail","wasedit",h);if(this.extEditable()&&this.isItem(h)){if(!this._trigger(h,"beforeedit",g)){this._fail(h,g);return}var i=this.edited();if(i.length){if(i[0]==h[0]){this._notify(h,g);return}else{this._editableDOM.remove.call(this,i);this._trigger(i,"endedit",g)}}this._editableDOM.add.call(this,h);this._focusEdit(h);this._success(h,g)}else{this._fail(h,g)}},endEdit:function(g){var h=this.edited();g=this._options(g,"edited","endeditfail","endedit",h);if(this.extEditable()&&this.isItem(h)){if(!this._trigger(h,"beforeendedit",g)){this._fail(h,g);return}var i=this._editableDOM.get(h).val();this._editableDOM.remove.call(this,h);if((g.save===f)||g.save){this.setLabel(h,{label:i});this._success(h,g)}else{this._notify(h,g)}}else{this._fail(h,g)}},extEditable:function(){return this._instance.options.editable},option:function(g,h){if(this.wasInit()&&!this.isLocked()){if((g=="editable")&&(h!=this.extEditable())){if(h){this._editableInit()}else{this._editableDone()}}}this._super(g,h)},_editableDone:function(){this._instance.jQuery.unbind(this._private.nameSpace);this._instance.jQuery.off(this._private.nameSpace,".aciTreeItem");this._instance.jQuery.off(this._private.nameSpace,"input[type=text]");var g=this.edited();if(g.length){this.endEdit()}},_destroyHook:function(g){if(g){this._editableDone()}this._super(g)}};aciPluginClass.plugins.aciTree=aciPluginClass.plugins.aciTree.extend(e,"aciTreeEditable");aciPluginClass.defaults("aciTree",b);var a=aciPluginClass.plugins.aciTree_dom})(jQuery,this); // persist (require utils extension & jStorage plugin) (function(c,b,e){var a={persist:null};var d={__extend:function(){c.extend(this._private,{selectTimeout:null,focusTimeout:null,openTimeout:null});this._super()},_initPersist:function(){this._instance.jQuery.bind("acitree"+this._private.nameSpace,function(j,h,i,f,g){if(g.uid=="ui.persist"){return}switch(f){case"init":h._persistRestore();break;case"selected":case"deselected":h._persistLater("selected");break;case"focus":case"blur":h._persistLater("focused");break;case"opened":case"closed":h._persistLater("opened");break}})},_initHook:function(){if(this.extPersist()){this._initPersist()}this._super()},_persistLater:function(f){switch(f){case"selected":b.clearTimeout(this._private.selectTimeout);this._private.selectTimeout=b.setTimeout(this.proxy(function(){this._persistSelected()}),250);break;case"focused":b.clearTimeout(this._private.focusTimeout);this._private.focusTimeout=b.setTimeout(this.proxy(function(){this._persistFocused()}),250);break;case"opened":b.clearTimeout(this._private.openTimeout);this._private.openTimeout=b.setTimeout(this.proxy(function(){this._persistOpened()}),250);break}},_persistRestore:function(){var f=new this._queue(this,this._instance.options.queue);var g=new this._task(f,function(k){if(this.extSelectable&&this.extSelectable()){var m=c.jStorage.get("aciTree_"+this._instance.options.persist+"_selected");if(m instanceof Array){for(var l in m){(function(i){f.push(function(o){this.searchPath(null,{success:function(p){this.select(p,{uid:"ui.persist",success:function(){o()},fail:o,focus:false})},fail:o,path:i.split(";")})})})(m[l]);if(!this._instance.options.multiSelectable){break}}}var n=c.jStorage.get("aciTree_"+this._instance.options.persist+"_focused");if(n instanceof Array){for(var l in n){(function(i){f.push(function(o){this.searchPath(null,{success:function(p){this.focus(p,{uid:"ui.persist",success:function(q){this.setVisible(q,{center:true});o()},fail:o})},fail:o,path:i.split(";")})})})(n[l])}}}k()});var j=c.jStorage.get("aciTree_"+this._instance.options.persist+"_opened");if(j instanceof Array){for(var h in j){(function(i){g.push(function(k){this.searchPath(null,{success:function(l){this.open(l,{uid:"ui.persist",success:k,fail:k})},fail:k,path:i.split(";"),load:true})})})(j[h])}}},_persistSelected:function(){if(this.extSelectable&&this.extSelectable()){var f=[];this.selected().each(this.proxy(function(g){var h=c(g);var i=this.pathId(h);i.push(this.getId(h));f.push(i.join(";"))},true));c.jStorage.set("aciTree_"+this._instance.options.persist+"_selected",f)}},_persistFocused:function(){if(this.extSelectable&&this.extSelectable()){var f=[];this.focused().each(this.proxy(function(g){var h=c(g);var i=this.pathId(h);i.push(this.getId(h));f.push(i.join(";"))},true));c.jStorage.set("aciTree_"+this._instance.options.persist+"_focused",f)}},_persistOpened:function(){var f=[];this.inodes(this.children(null,true),true).each(this.proxy(function(g){var h=c(g);if(this.isOpenPath(h)){var i=this.pathId(h);i.push(this.getId(h));f.push(i.join(";"))}},true));c.jStorage.set("aciTree_"+this._instance.options.persist+"_opened",f)},isPersist:function(){if(this.extPersist()){var f=c.jStorage.get("aciTree_"+this._instance.options.persist+"_selected");if(f instanceof Array){return true}var g=c.jStorage.get("aciTree_"+this._instance.options.persist+"_focused");if(g instanceof Array){return true}var h=c.jStorage.get("aciTree_"+this._instance.options.persist+"_opened");if(h instanceof Array){return true}}return false},unpersist:function(){if(this.extPersist()){c.jStorage.deleteKey("aciTree_"+this._instance.options.persist+"_selected");c.jStorage.deleteKey("aciTree_"+this._instance.options.persist+"_focused");c.jStorage.deleteKey("aciTree_"+this._instance.options.persist+"_opened")}},extPersist:function(){return this._instance.options.persist},option:function(f,h){var g=this.extPersist();this._super(f,h);if(this.extPersist()!=g){if(g){this._donePersist()}else{this._initPersist()}}},_donePersist:function(){this._instance.jQuery.unbind(this._private.nameSpace)},_destroyHook:function(f){if(f){this._donePersist()}this._super(f)}};aciPluginClass.plugins.aciTree=aciPluginClass.plugins.aciTree.extend(d,"aciTreePersist");aciPluginClass.defaults("aciTree",a)})(jQuery,this); // hash (require utils extension & aciFragment plugin) (function(d,c,e){var a={selectHash:null,openHash:null};var b={__extend:function(){d.extend(this._private,{lastSelect:null,lastOpen:null,hashApi:null});this._super()},_hashInit:function(){this._instance.jQuery.aciFragment();this._private.hashApi=this._instance.jQuery.aciFragment("api");this._instance.jQuery.bind("acitree"+this._private.nameSpace,function(j,h,i,f,g){switch(f){case"init":h._hashRestore();break}}).bind("acifragment"+this._private.nameSpace,this.proxy(function(h,g,f){h.stopPropagation();this._hashRestore()}))},_initHook:function(){if(this.extHast()){this._hashInit()}this._super()},_hashRestore:function(){var f=this._instance.queue;var i=function(l){for(var k in l){(function(m){f.push(function(n){this.search(null,{success:function(o){this.open(o,{uid:"ui.hash",success:n,fail:n})},fail:n,search:m})})})(l[k])}};if(this._instance.options.openHash){var h=this._private.hashApi.get(this._instance.options.openHash,"");if(h.length&&(h!=this._private.lastOpen)){this._private.lastOpen=h;var j=h.split(";");i(j)}}if(this._instance.options.selectHash&&this.extSelectable&&this.extSelectable()){var h=this._private.hashApi.get(this._instance.options.selectHash,"");if(h.length&&(h!=this._private.lastSelect)){this._private.lastSelect=h;var j=h.split(";");var g=j.pop();i(j);if(g){f.push(function(k){this.search(null,{success:function(l){this.select(l,{uid:"ui.hash",success:function(m){this.setVisible(m,{center:true});k()},fail:k})},fail:k,search:g})})}}}},extHast:function(){return this._instance.options.selectHash||this._instance.options.openHash},option:function(f,g){var h=this.extHast();this._super(f,g);if(this.extHast()!=h){if(h){this._hashDone()}else{this._hashInit()}}},_hashDone:function(){this._instance.jQuery.unbind(this._private.nameSpace);this._private.hashApi=null;this._instance.jQuery.aciFragment("destroy")},_destroyHook:function(f){if(f){this._hashDone()}this._super(f)}};aciPluginClass.plugins.aciTree=aciPluginClass.plugins.aciTree.extend(b,"aciTreeHash");aciPluginClass.defaults("aciTree",a)})(jQuery,this); // sortable (require utils extension & aciSortable plugin) (function(d,c,e){var a={sortable:false,sortDelay:750,sortDrag:function(h,j,i,g){if(!i){var f=this.getLabel(h);if(this._private.dragDrop&&(this._private.dragDrop.length>1)){f+=" and #"+(this._private.dragDrop.length-1)+" more"}g.html(f)}},sortValid:function(j,h,k,g,l,i){var f=this.getLabel(j);if(this._private.dragDrop.length>1){f+=" and #"+(this._private.dragDrop.length-1)+" more"}if(g){i.html("move "+f+" to "+this.getLabel(this.itemFrom(h)));l.removeClass("aciTreeAfter aciTreeBefore")}else{if(k!==null){if(k){i.html("move "+f+" before "+this.getLabel(h));l.removeClass("aciTreeAfter").addClass("aciTreeBefore")}else{i.html("move "+f+" after "+this.getLabel(h));l.removeClass("aciTreeBefore").addClass("aciTreeAfter")}}}}};var b={__extend:function(){d.extend(this._private,{openTimeout:null,dragDrop:null});this._super()},_sortableInit:function(){this._instance.jQuery.aciSortable({container:".aciTreeUl",item:".aciTreeLi",child:50,childHolder:'
    ',childHolderSelector:".aciTreeChild",placeholder:'
  • ',placeholderSelector:".aciTreePlaceholder",helper:'
    ',helperSelector:".aciTreeHelper",before:this.proxy(function(f){if(!this._initDrag(f)){return false}if(!this._trigger(f,"beforedrag")){this._trigger(f,"dragfail");return false}return true}),start:this.proxy(function(g,h,f){this._instance.jQuery.addClass("aciTreeDragDrop");f.css({opacity:1}).html(this.getLabel(g))}),drag:this.proxy(function(g,i,h,f){if(!h){c.clearTimeout(this._private.openTimeout)}if(this._instance.options.sortDrag){this._instance.options.sortDrag.apply(this,arguments)}}),valid:this.proxy(function(j,h,k,g,l,i){c.clearTimeout(this._private.openTimeout);if(!this._checkDrop(j,h,k,g,l,i)){return false}var f=this._options({hover:h,before:k,isContainer:g,placeholder:l,helper:i});if(!this._trigger(j,"checkdrop",f)){return false}if(this.isInode(h)&&!this.isOpen(h)){this._private.openTimeout=c.setTimeout(this.proxy(function(){this.open(h)}),this._instance.options.sortDelay)}if(this._instance.options.sortValid){this._instance.options.sortValid.apply(this,arguments)}return true}),create:this.proxy(function(g,h,f){if(this.isLeaf(f)){f.append(g._instance.options.childHolder);return true}return false},true),end:this.proxy(function(q,k,p,g){c.clearTimeout(this._private.openTimeout);var r={placeholder:p,helper:g};r=this._options(r,"sorted","dropfail",null,q);if(p.parent().length){var i=this.prev(p,true);if(i.length){p.detach();var l=d(this._private.dragDrop.get().reverse());this._private.dragDrop=null;l.each(this.proxy(function(s){this.moveAfter(d(s),this._inner(r,{success:r.success,fail:r.fail,after:i}))},true))}else{var j=this.next(p,true);if(j.length){p.detach();var l=d(this._private.dragDrop.get().reverse());this._private.dragDrop=null;l.each(this.proxy(function(s){this.moveBefore(d(s),this._inner(r,{success:r.success,fail:r.fail,before:j}))},true))}else{var o=this.parent(p);var f=p.parent();p.detach();f.remove();if(this.isLeaf(o)){var l=this._private.dragDrop;this.asChild(l.eq(0),this._inner(r,{success:function(){this._success(q,r);this.open(o);l.filter(":gt(0)").each(this.proxy(function(s){this.moveAfter(d(s),this._inner(r,{success:r.success,fail:r.fail,after:this.last(o)}))},true))},fail:r.fail,parent:o}))}else{this._fail(q,r)}}}}else{this._fail(q,r)}this._private.dragDrop=null;if(g.parent().length){var n=d(c).scrollTop();var h=d(c).scrollLeft();var m=q[0].getBoundingClientRect();g.animate({top:m.top+n,left:m.left+h,opacity:0},{complete:function(){g.detach()}})}this._instance.jQuery.removeClass("aciTreeDragDrop")})})},_initHook:function(){if(this.extSortable()){this._sortableInit()}this._super()},_parents:function(l){var h=l.length,k,g,f=[];for(var n=0;n