git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8655 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
177 lines
86 KiB
JavaScript
177 lines
86 KiB
JavaScript
/*
|
|
jsTree 1.0-rc1
|
|
http://jstree.com/
|
|
|
|
Copyright (c) 2010 Ivan Bozhanov (vakata.com)
|
|
|
|
Dual licensed under the MIT and GPL licenses (same as jQuery):
|
|
http://www.opensource.org/licenses/mit-license.php
|
|
http://www.gnu.org/licenses/gpl.html
|
|
*/
|
|
(function(b){b.vakata={};b.vakata.css={get_css:function(a,d,e){a=a.toLowerCase();var g=e.cssRules||e.rules,i=0;do{if(g.length&&i>g.length+5)break;if(g[i].selectorText&&g[i].selectorText.toLowerCase()==a)if(d===true){e.removeRule&&e.removeRule(i);e.deleteRule&&e.deleteRule(i);return true}else return g[i]}while(g[++i]);return false},add_css:function(a,d){if(b.jstree.css.get_css(a,false,d))return false;d.insertRule?d.insertRule(a+" { }",0):d.addRule(a,null,0);return b.vakata.css.get_css(a)},remove_css:function(a,
|
|
d){return b.vakata.css.get_css(a,true,d)},add_sheet:function(a){var d;if(a.str){d=document.createElement("style");d.setAttribute("type","text/css");if(d.styleSheet){document.getElementsByTagName("head")[0].appendChild(d);d.styleSheet.cssText=a.str}else{d.appendChild(document.createTextNode(a.str));document.getElementsByTagName("head")[0].appendChild(d)}return d.sheet||d.styleSheet}if(a.url)if(document.createStyleSheet)try{document.createStyleSheet(a.url)}catch(e){}else{d=document.createElement("link");
|
|
d.rel="stylesheet";d.type="text/css";d.media="all";d.href=a.url;document.getElementsByTagName("head")[0].appendChild(d);return d.styleSheet}}}})(jQuery);
|
|
(function(b){var a=[],d=-1,e={},g={},i=false;b.fn.jstree=function(c){var f=typeof c=="string",h=Array.prototype.slice.call(arguments,1),j=this;!f&&b.meta&&h.push(b.metadata.get(this).jstree);c=!f&&h.length?b.extend.apply(null,[true,c].concat(h)):c;if(f&&c.substring(0,1)=="_")return j;f?this.each(function(){var l=a[b.data(this,"jstree-instance-id")];l=l&&b.isFunction(l[c])?l[c].apply(l,h):l;if(typeof l!=="undefined"&&(c.indexOf("is_"===0)||l!==true&&l!==false)){j=l;return false}}):this.each(function(){var l=
|
|
b.data(this,"jstree-instance-id"),k=false;typeof l!=="undefined"&&a[l]&&a[l].destroy();l=parseInt(a.push({}),10)-1;b.data(this,"jstree-instance-id",l);c||(c={});c.plugins=b.isArray(c.plugins)?c.plugins:b.jstree.defaults.plugins;b.inArray("core",c.plugins)===-1&&c.plugins.unshift("core");k=b.extend(true,{},b.jstree.defaults,c);k.plugins=c.plugins;b.each(e,function(m){if(b.inArray(m,k.plugins)===-1){k[m]=null;delete k[m]}});a[l]=new b.jstree._instance(l,b(this).addClass("jstree jstree-"+l),k);b.each(a[l]._get_settings().plugins,
|
|
function(m,n){a[l].data[n]={}});b.each(a[l]._get_settings().plugins,function(m,n){e[n]&&e[n].__init.apply(a[l])});a[l].init()});return j};b.jstree={defaults:{plugins:[]},_focused:function(){return a[d]||null},_reference:function(c){if(a[c])return a[c];var f=b(c);if(!f.length&&typeof c==="string")f=b("#"+c);if(!f.length)return null;return a[f.closest(".jstree").data("jstree-instance-id")]||null},_instance:function(c,f,h){this.data={core:{}};this.get_settings=function(){return b.extend(true,{},h)};
|
|
this._get_settings=function(){return h};this.get_index=function(){return c};this.get_container=function(){return f};this._set_settings=function(j){h=b.extend(true,{},h,j)}},_fn:{},plugin:function(c,f){f=b.extend({},{__init:b.noop,__destroy:b.noop,_fn:{},defaults:false},f);e[c]=f;b.jstree.defaults[c]=f.defaults;b.each(f._fn,function(h,j){j.plugin=c;j.old=b.jstree._fn[h];b.jstree._fn[h]=function(){var l,k=j,m=Array.prototype.slice.call(arguments);l=new b.Event("before.jstree");var n=false;do{if(k&&
|
|
k.plugin&&b.inArray(k.plugin,this._get_settings().plugins)!==-1)break;k=k.old}while(k);if(k){l=this.get_container().triggerHandler(l,{func:h,inst:this,args:m});if(l!==false){if(typeof l!=="undefined")m=l;return l=h.indexOf("_")===0?k.apply(this,m):k.apply(b.extend({},this,{__callback:function(p){this.get_container().triggerHandler(h+".jstree",{inst:this,args:m,rslt:p,rlbk:n})},__rollback:function(){return n=this.get_rollback()},__call_old:function(p){return k.old.apply(this,p?Array.prototype.slice.call(arguments,
|
|
1):m)}}),m)}}};b.jstree._fn[h].old=j.old;b.jstree._fn[h].plugin=c})},rollback:function(c){if(c){b.isArray(c)||(c=[c]);b.each(c,function(f,h){a[h.i].set_rollback(h.h,h.d)})}}};b.jstree._fn=b.jstree._instance.prototype={};b(function(){var c=navigator.userAgent.toLowerCase(),f=(c.match(/.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],h=".jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } .jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; } .jstree-rtl li { margin-left:0; margin-right:18px; } .jstree > ul > li { margin-left:0px; } .jstree-rtl > ul > li { margin-right:0px; } .jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } .jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } .jstree a:focus { outline: none; } .jstree a > ins { height:16px; width:16px; } .jstree a > .jstree-icon { margin-right:3px; } .jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } li.jstree-open > ul { display:block; } li.jstree-closed > ul { display:none; } ";
|
|
if(/msie/.test(c)&&parseInt(f,10)==6){i=true;h+=".jstree li { height:18px; margin-left:0; margin-right:0; } .jstree li li { margin-left:18px; } .jstree-rtl li li { margin-left:0px; margin-right:18px; } li.jstree-open ul { display:block; } li.jstree-closed ul { display:none !important; } .jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } .jstree li a ins { height:16px; width:16px; margin-right:3px; } .jstree-rtl li a ins { margin-right:0px; margin-left:3px; } "}if(/msie/.test(c)&&
|
|
parseInt(f,10)==7)h+=".jstree li a { border-width:0 !important; padding:0px 2px !important; } ";b.vakata.css.add_sheet({str:h})});b.jstree.plugin("core",{__init:function(){this.data.core.to_open=b.map(b.makeArray(this.get_settings().core.initially_open),function(c){return"#"+c.toString().replace(/^#/,"").replace("\\/","/").replace("/","\\/")})},defaults:{html_titles:false,animation:500,initially_open:[],rtl:false,strings:{loading:"Loading ...",new_node:"New node"}},_fn:{init:function(){this.set_focus();
|
|
this._get_settings().core.rtl&&this.get_container().addClass("jstree-rtl").css("direction","rtl");this.get_container().html("<ul><li class='jstree-last jstree-leaf'><ins> </ins><a class='jstree-loading' href='#'><ins class='jstree-icon'> </ins>"+this._get_settings().core.strings.loading+"</a></li></ul>");this.data.core.li_height=this.get_container().find("ul li.jstree-closed, ul li.jstree-leaf").eq(0).height()||18;this.get_container().delegate("li > ins","click.jstree",b.proxy(function(c){var f=
|
|
b(c.target);f.is("ins")&&c.pageY-f.offset().top<this.data.core.li_height&&this.toggle_node(f)},this)).bind("mousedown.jstree",b.proxy(function(){this.set_focus()},this)).bind("dblclick.jstree",function(){var c;if(document.selection&&document.selection.empty)document.selection.empty();else if(window.getSelection){c=window.getSelection();try{c.removeAllRanges();c.collapse()}catch(f){}}});this.__callback();this.load_node(-1,function(){this.loaded();this.reopen()})},destroy:function(){var c,f=this.get_index(),
|
|
h=this._get_settings(),j=this;b.each(h.plugins,function(l,k){try{e[k].__destroy.apply(j)}catch(m){}});this.__callback();if(this.is_focused())for(c in a)if(a.hasOwnProperty(c)&&c!=f){a[c].set_focus();break}if(f===d)d=-1;this.get_container().unbind(".jstree").undelegate(".jstree").removeData("jstree-instance-id").find("[class^='jstree']").andSelf().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/ig,"")});a[f]=null;delete a[f]},save_opened:function(){var c=this;this.data.core.to_open=
|
|
[];this.get_container().find(".jstree-open").each(function(){c.data.core.to_open.push("#"+this.id.toString().replace(/^#/,"").replace("\\/","/").replace("/","\\/"))});this.__callback(c.data.core.to_open)},reopen:function(c){var f=this,h=true,j=[],l=[];if(!c){this.data.core.reopen=false;this.data.core.refreshing=true}if(this.data.core.to_open.length){b.each(this.data.core.to_open,function(k,m){if(m=="#")return true;b(m).length&&b(m).is(".jstree-closed")?j.push(m):l.push(m)});if(j.length){this.data.core.to_open=
|
|
l;b.each(j,function(k,m){f.open_node(m,function(){f.reopen(true)},true)});h=false}}if(h){this.data.core.reopen&&clearTimeout(this.data.core.reopen);this.data.core.reopen=setTimeout(function(){f.__callback({},f)},50);this.data.core.refreshing=false}},refresh:function(c){var f=this;this.save_opened();c||(c=-1);(c=this._get_node(c))||(c=-1);c!==-1&&c.children("UL").remove();this.load_node(c,function(){f.__callback({obj:c});f.reopen()})},loaded:function(){this.__callback()},set_focus:function(){var c=
|
|
b.jstree._focused();c&&c!==this&&c.get_container().removeClass("jstree-focused");if(c!==this){this.get_container().addClass("jstree-focused");d=this.get_index()}this.__callback()},is_focused:function(){return d==this.get_index()},_get_node:function(c){var f=b(c,this.get_container());if(f.is(".jstree")||c==-1)return-1;f=f.closest("li",this.get_container());return f.length?f:false},_get_next:function(c,f){c=this._get_node(c);if(c===-1)return this.get_container().find("> ul > li:first-child");if(!c.length)return false;
|
|
if(f)return c.nextAll("li").size()>0?c.nextAll("li:eq(0)"):false;return c.hasClass("jstree-open")?c.find("li:eq(0)"):c.nextAll("li").size()>0?c.nextAll("li:eq(0)"):c.parentsUntil(".jstree","li").next("li").eq(0)},_get_prev:function(c,f){c=this._get_node(c);if(c===-1)return this.get_container().find("> ul > li:last-child");if(!c.length)return false;if(f)return c.prevAll("li").length>0?c.prevAll("li:eq(0)"):false;if(c.prev("li").length){for(c=c.prev("li").eq(0);c.hasClass("jstree-open");)c=c.children("ul:eq(0)").children("li:last");
|
|
return c}else{var h=c.parentsUntil(".jstree","li:eq(0)");return h.length?h:false}},_get_parent:function(c){c=this._get_node(c);if(c==-1||!c.length)return false;c=c.parentsUntil(".jstree","li:eq(0)");return c.length?c:-1},_get_children:function(c){c=this._get_node(c);if(c===-1)return this.get_container().children("ul:eq(0)").children("li");if(!c.length)return false;return c.children("ul:eq(0)").children("li")},get_path:function(c,f){var h=[],j=this;c=this._get_node(c);if(c===-1||!c||!c.length)return false;
|
|
c.parentsUntil(".jstree","li").each(function(){h.push(f?this.id:j.get_text(this))});h.reverse();h.push(f?c.attr("id"):this.get_text(c));return h},is_open:function(c){return(c=this._get_node(c))&&c!==-1&&c.hasClass("jstree-open")},is_closed:function(c){return(c=this._get_node(c))&&c!==-1&&c.hasClass("jstree-closed")},is_leaf:function(c){return(c=this._get_node(c))&&c!==-1&&c.hasClass("jstree-leaf")},open_node:function(c,f,h){c=this._get_node(c);if(!c.length)return false;if(!c.hasClass("jstree-closed")){f&&
|
|
f.call();return false}var j=h||i?0:this._get_settings().core.animation,l=this;if(this._is_loaded(c)){j&&c.children("ul").css("display","none");c.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading");j&&c.children("ul").stop(true).slideDown(j,function(){this.style.display=""});this.__callback({obj:c});f&&f.call()}else{c.children("a").addClass("jstree-loading");this.load_node(c,function(){l.open_node(c,f,h)},f)}},close_node:function(c,f){c=this._get_node(c);
|
|
var h=f||i?0:this._get_settings().core.animation;if(!c.length||!c.hasClass("jstree-open"))return false;h&&c.children("ul").attr("style","display:block !important");c.removeClass("jstree-open").addClass("jstree-closed");h&&c.children("ul").stop(true).slideUp(h,function(){this.style.display=""});this.__callback({obj:c})},toggle_node:function(c){c=this._get_node(c);if(c.hasClass("jstree-closed"))return this.open_node(c);if(c.hasClass("jstree-open"))return this.close_node(c)},open_all:function(c,f){c=
|
|
c?this._get_node(c):this.get_container();if(!c||c===-1)c=this.get_container();if(f)c=c.find("li.jstree-closed");else{f=c;c=c.is(".jstree-closed")?c.find("li.jstree-closed").andSelf():c.find("li.jstree-closed")}var h=this;c.each(function(){var j=this;h._is_loaded(this)?h.open_node(this,false,true):h.open_node(this,function(){h.open_all(j,f)},true)});f.find("li.jstree-closed").length===0&&this.__callback({obj:f})},close_all:function(c){var f=this;c=c?this._get_node(c):this.get_container();if(!c||c===
|
|
-1)c=this.get_container();c.find("li.jstree-open").andSelf().each(function(){f.close_node(this)});this.__callback({obj:c})},clean_node:function(c){c=c&&c!=-1?b(c):this.get_container();c=c.is("li")?c.find("li").andSelf():c.find("li");c.removeClass("jstree-last").filter("li:last-child").addClass("jstree-last").end().filter(":has(li)").not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed");c.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove();this.__callback({obj:c})},
|
|
get_rollback:function(){this.__callback();return{i:this.get_index(),h:this.get_container().children("ul").clone(true),d:this.data}},set_rollback:function(c,f){this.get_container().empty().append(c);this.data=f;this.__callback()},load_node:function(c){this.__callback({obj:c})},_is_loaded:function(){return true},create_node:function(c,f,h,j,l){c=this._get_node(c);f=typeof f==="undefined"?"last":f;var k=b("<li>"),m=this._get_settings().core,n;if(c!==-1&&!c.length)return false;if(!l&&!this._is_loaded(c)){this.load_node(c,
|
|
function(){this.create_node(c,f,h,j,true)});return false}this.__rollback();if(typeof h==="string")h={data:h};h||(h={});h.attr&&k.attr(h.attr);h.state&&k.addClass("jstree-"+h.state);if(!h.data)h.data=m.strings.new_node;if(!b.isArray(h.data)){n=h.data;h.data=[];h.data.push(n)}b.each(h.data,function(p,o){n=b("<a>");if(b.isFunction(o))o=o.call(this,h);if(typeof o=="string")n.attr("href","#")[m.html_titles?"html":"text"](o);else{if(!o.attr)o.attr={};if(!o.attr.href)o.attr.href="#";n.attr(o.attr)[m.html_titles?
|
|
"html":"text"](o.title);o.language&&n.addClass(o.language)}n.prepend("<ins class='jstree-icon'> </ins>");if(o.icon)o.icon.indexOf("/")===-1?n.children("ins").addClass(o.icon):n.children("ins").css("background","url('"+o.icon+"') center center no-repeat");k.append(n)});k.prepend("<ins class='jstree-icon'> </ins>");if(c===-1){c=this.get_container();if(f==="before")f="first";if(f==="after")f="last"}switch(f){case "before":c.before(k);n=this._get_parent(c);break;case "after":c.after(k);n=this._get_parent(c);
|
|
break;case "inside":case "first":c.children("ul").length||c.append("<ul>");c.children("ul").prepend(k);n=c;break;case "last":c.children("ul").length||c.append("<ul>");c.children("ul").append(k);n=c;break;default:c.children("ul").length||c.append("<ul>");f||(f=0);n=c.children("ul").children("li").eq(f);n.length?n.before(k):c.children("ul").append(k);n=c}if(n===-1||n.get(0)===this.get_container().get(0))n=-1;this.clean_node(n);this.__callback({obj:k,parent:n});j&&j.call(this,k);return k},get_text:function(c){c=
|
|
this._get_node(c);if(!c.length)return false;var f=this._get_settings().core.html_titles;c=c.children("a:eq(0)");if(f){c=c.clone();c.children("INS").remove();return c.html()}else{c=c.contents().filter(function(){return this.nodeType==3})[0];return c.nodeValue}},set_text:function(c,f){c=this._get_node(c);if(!c.length)return false;c=c.children("a:eq(0)");if(this._get_settings().core.html_titles){var h=c.children("INS").clone();c.html(f).prepend(h);this.__callback({obj:c,name:f});return true}else{c=c.contents().filter(function(){return this.nodeType==
|
|
3})[0];this.__callback({obj:c,name:f});return c.nodeValue=f}},rename_node:function(c,f){c=this._get_node(c);this.__rollback();c&&c.length&&this.set_text.apply(this,Array.prototype.slice.call(arguments))&&this.__callback({obj:c,name:f})},delete_node:function(c){c=this._get_node(c);if(!c.length)return false;this.__rollback();var f=this._get_parent(c),h=this._get_prev(c);c=c.remove();f!==-1&&f.find("> ul > li").length===0&&f.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");this.clean_node(f);
|
|
this.__callback({obj:c,prev:h});return c},prepare_move:function(c,f,h,j,l){var k={};k.ot=b.jstree._reference(k.o)||this;k.o=k.ot._get_node(c);k.r=f===-1?-1:this._get_node(f);k.p=typeof k==="undefined"?"last":h;if(!(!l&&g.o&&g.o[0]===k.o[0]&&g.r[0]===k.r[0]&&g.p===k.p)){k.ot=b.jstree._reference(k.o)||this;k.rt=f===-1?k.ot:b.jstree._reference(k.r)||this;if(k.r===-1){k.cr=-1;switch(k.p){case "first":case "before":case "inside":k.cp=0;break;case "after":case "last":k.cp=k.rt.get_container().find(" > ul > li").length;
|
|
break;default:k.cp=k.p}}else{if(!/^(before|after)$/.test(k.p)&&!this._is_loaded(k.r))return this.load_node(k.r,function(){this.prepare_move(c,f,h,j,true)});switch(k.p){case "before":k.cp=k.r.index();k.cr=k.rt._get_parent(k.r);break;case "after":k.cp=k.r.index()+1;k.cr=k.rt._get_parent(k.r);break;case "inside":case "first":k.cp=0;k.cr=k.r;break;case "last":k.cp=k.r.find(" > ul > li").length;k.cr=k.r;break;default:k.cp=k.p;k.cr=k.r}}k.np=k.cr==-1?k.rt.get_container():k.cr;k.op=k.ot._get_parent(k.o);
|
|
k.or=k.np.find(" > ul > li:nth-child("+(k.cp+1)+")");g=k}this.__callback(g);j&&j.call(this,g)},check_move:function(){var c=g,f=true;if(c.or[0]===c.o[0])return false;c.o.each(function(){if(c.r.parentsUntil(".jstree").andSelf().filter("li").index(this)!==-1)return f=false});return f},move_node:function(c,f,h,j,l,k){if(!l)return this.prepare_move(c,f,h,function(n){this.move_node(n,false,false,j,true,k)});if(!k&&!this.check_move())return false;this.__rollback();f=false;if(j){f=c.o.clone();f.find("*[id]").andSelf().each(function(){if(this.id)this.id=
|
|
"copy_"+this.id})}else f=c.o;if(c.or.length)c.or.before(f);else{c.np.children("ul").length||b("<ul>").appendTo(c.np);c.np.children("ul:eq(0)").append(f)}try{c.ot.clean_node(c.op);c.rt.clean_node(c.np);c.op.find("> ul > li").length||c.op.removeClass("jstree-open jstree-closed").addClass("jstree-leaf").children("ul").remove()}catch(m){}if(j){g.cy=true;g.oc=f}this.__callback(g);return g},_get_move:function(){return g}}})})(jQuery);
|
|
(function(b){b.jstree.plugin("ui",{__init:function(){this.data.ui.selected=b();this.data.ui.last_selected=false;this.data.ui.hovered=null;this.data.ui.to_select=this.get_settings().ui.initially_select;this.get_container().delegate("a","click.jstree",b.proxy(function(a){a.preventDefault();this.select_node(a.currentTarget,true,a)},this)).delegate("a","mouseenter.jstree",b.proxy(function(a){this.hover_node(a.target)},this)).delegate("a","mouseleave.jstree",b.proxy(function(a){this.dehover_node(a.target)},
|
|
this)).bind("reopen.jstree",b.proxy(function(){this.reselect()},this)).bind("get_rollback.jstree",b.proxy(function(){this.dehover_node();this.save_selected()},this)).bind("set_rollback.jstree",b.proxy(function(){this.reselect()},this)).bind("close_node.jstree",b.proxy(function(a,d){var e=this._get_settings().ui,g=this._get_node(d.rslt.obj),i=g&&g.length?g.children("ul").find(".jstree-clicked"):b(),c=this;e.selected_parent_close===false||!i.length||i.each(function(){c.deselect_node(this);e.selected_parent_close===
|
|
"select_parent"&&c.select_node(g)})},this)).bind("delete_node.jstree",b.proxy(function(a,d){var e=this._get_settings().ui.select_prev_on_delete,g=this._get_node(d.rslt.obj);g=g&&g.length?g.find(".jstree-clicked"):[];var i=this;g.each(function(){i.deselect_node(this)});e&&g.length&&this.select_node(d.rslt.prev)},this)).bind("move_node.jstree",b.proxy(function(a,d){d.rslt.cy&&d.rslt.oc.find(".jstree-clicked").removeClass("jstree-clicked")},this))},defaults:{select_limit:-1,select_multiple_modifier:"ctrl",
|
|
selected_parent_close:"select_parent",select_prev_on_delete:true,disable_selecting_children:false,initially_select:[]},_fn:{_get_node:function(a,d){if(typeof a==="undefined"||a===null)return d?this.data.ui.selected:this.data.ui.last_selected;var e=b(a,this.get_container());if(e.is(".jstree")||a==-1)return-1;e=e.closest("li",this.get_container());return e.length?e:false},save_selected:function(){var a=this;this.data.ui.to_select=[];this.data.ui.selected.each(function(){a.data.ui.to_select.push("#"+
|
|
this.id.toString().replace(/^#/,"").replace("\\/","/").replace("/","\\/"))});this.__callback(this.data.ui.to_select)},reselect:function(){var a=this,d=this.data.ui.to_select;d=b.map(b.makeArray(d),function(e){return"#"+e.toString().replace(/^#/,"").replace("\\/","/").replace("/","\\/")});this.deselect_all();b.each(d,function(e,g){g&&g!=="#"&&a.select_node(g)});this.__callback()},refresh:function(){this.save_selected();return this.__call_old()},hover_node:function(a){a=this._get_node(a);if(!a.length)return false;
|
|
a.hasClass("jstree-hovered")||this.dehover_node();this.data.ui.hovered=a.children("a").addClass("jstree-hovered").parent();this.__callback({obj:a})},dehover_node:function(){var a=this.data.ui.hovered;if(!a||!a.length)return false;if(this.data.ui.hovered[0]===a.children("a").removeClass("jstree-hovered").parent()[0])this.data.ui.hovered=null;this.__callback({obj:a})},select_node:function(a,d,e){a=this._get_node(a);if(a==-1||!a||!a.length)return false;var g=this._get_settings().ui;e=g.select_multiple_modifier==
|
|
"on"||g.select_multiple_modifier!==false&&e&&e[g.select_multiple_modifier+"Key"];var i=this.is_selected(a),c=true;if(d){if(g.disable_selecting_children&&e&&a.parents("li",this.get_container()).children(".jstree-clicked").length)return false;c=false;switch(true){case i&&!e:this.deselect_all();i=false;c=true;break;case !i&&!e:if(g.select_limit==-1||g.select_limit>0){this.deselect_all();c=true}break;case i&&e:this.deselect_node(a);break;case !i&&e:if(g.select_limit==-1||this.data.ui.selected.length+
|
|
1<=g.select_limit)c=true}}if(c&&!i){a.children("a").addClass("jstree-clicked");this.data.ui.selected=this.data.ui.selected.add(a);this.data.ui.last_selected=a;this.__callback({obj:a})}},deselect_node:function(a){a=this._get_node(a);if(!a.length)return false;if(this.is_selected(a)){a.children("a").removeClass("jstree-clicked");this.data.ui.selected=this.data.ui.selected.not(a);if(this.data.ui.last_selected.get(0)===a.get(0))this.data.ui.last_selected=this.data.ui.selected.eq(0);this.__callback({obj:a})}},
|
|
toggle_select:function(a){a=this._get_node(a);if(!a.length)return false;this.is_selected(a)?this.deselect_node(a):this.select_node(a)},is_selected:function(a){return this.data.ui.selected.index(this._get_node(a))>=0},get_selected:function(a){return a?b(a).find(".jstree-clicked").parent():this.data.ui.selected},deselect_all:function(a){a?b(a).find(".jstree-clicked").removeClass("jstree-clicked"):this.get_container().find(".jstree-clicked").removeClass("jstree-clicked");this.data.ui.selected=b([]);
|
|
this.data.ui.last_selected=false;this.__callback()}}});b.jstree.defaults.plugins.push("ui")})(jQuery);
|
|
(function(b){b.jstree.plugin("crrm",{__init:function(){this.get_container().bind("move_node.jstree",b.proxy(function(a,d){if(this._get_settings().crrm.move.open_onmove){var e=this;d.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function(){e.open_node(this,false,true)})}},this))},defaults:{input_width_limit:200,move:{always_copy:false,open_onmove:true,default_position:"last",check_move:function(){return true}}},_fn:{_show_input:function(a,d){a=this._get_node(a);var e=this._get_settings().core.rtl,
|
|
g=this._get_settings().crrm.input_width_limit,i=a.children("ins").width(),c=a.find("> a:visible > ins").width()*a.find("> a:visible > ins").length,f=this.get_text(a),h=b("<div>",{css:{position:"absolute",top:"-200px",left:e?"0px":"-1000px",visibility:"hidden"}}).appendTo("body"),j=a.css("position","relative").append(b("<input>",{value:f,css:{padding:"0",border:"1px solid silver",position:"absolute",left:e?"auto":i+c+4+"px",right:e?i+c+4+"px":"auto",top:"0px",height:this.data.core.li_height-2+"px",
|
|
lineHeight:this.data.core.li_height-2+"px",width:"150px"},blur:b.proxy(function(){var l=a.children("input"),k=l.val();if(k==="")k=f;l.remove();this.set_text(a,f);this.rename_node(a,k);d.call(this,a,k,f);a.css("position","")},this),keyup:function(l){l=l.keyCode||l.which;if(l==27){this.value=f;this.blur()}else l==13?this.blur():j.width(Math.min(h.text("pW"+this.value).width(),g))}})).children("input");this.set_text(a,"");h.css({fontFamily:j.css("fontFamily")||"",fontSize:j.css("fontSize")||"",fontWeight:j.css("fontWeight")||
|
|
"",fontStyle:j.css("fontStyle")||"",fontStretch:j.css("fontStretch")||"",fontVariant:j.css("fontVariant")||"",letterSpacing:j.css("letterSpacing")||"",wordSpacing:j.css("wordSpacing")||""});j.width(Math.min(h.text("pW"+j[0].value).width(),g))[0].select()},rename:function(a){a=this._get_node(a);this.__rollback();var d=this.__callback;this._show_input(a,function(e,g,i){d.call(this,{obj:e,new_name:g,old_name:i})})},create:function(a,d,e,g,i){var c=this;(a=this._get_node(a))||(a=-1);this.__rollback();
|
|
return this.create_node(a,d,e,function(f){var h=this._get_parent(f),j=b(f).index();g&&g.call(this,f);h.length&&h.hasClass("jstree-closed")&&this.open_node(h,false,true);i?c.__callback({obj:f,name:this.get_text(f),parent:h,position:j}):this._show_input(f,function(l,k){c.__callback({obj:l,name:k,parent:h,position:j})})})},remove:function(a){a=this._get_node(a,true);this.__rollback();this.delete_node(a);this.__callback({obj:a})},check_move:function(){if(!this.__call_old())return false;if(!this._get_settings().crrm.move.check_move.call(this,
|
|
this._get_move()))return false;return true},move_node:function(a,d,e,g,i,c){var f=this._get_settings().crrm.move;if(!i){if(!e)e=f.default_position;if(e==="inside"&&!f.default_position.match(/^(before|after)$/))e=f.default_position;return this.__call_old(true,a,d,e,g,false,c)}if(f.always_copy===true||f.always_copy==="multitree"&&a.rt.get_index()!==a.ot.get_index())g=true;this.__call_old(true,a,d,e,g,true,c)},cut:function(a){a=this._get_node(a);this.data.crrm.cp_nodes=false;this.data.crrm.ct_nodes=
|
|
false;if(!a||!a.length)return false;this.data.crrm.ct_nodes=a},copy:function(a){a=this._get_node(a);this.data.crrm.cp_nodes=false;this.data.crrm.ct_nodes=false;if(!a||!a.length)return false;this.data.crrm.cp_nodes=a},paste:function(a){a=this._get_node(a);if(!a||!a.length)return false;if(!this.data.crrm.ct_nodes&&!this.data.crrm.cp_nodes)return false;this.data.crrm.ct_nodes&&this.move_node(this.data.crrm.ct_nodes,a);this.data.crrm.cp_nodes&&this.move_node(this.data.crrm.cp_nodes,a,false,true);this.data.crrm.cp_nodes=
|
|
false;this.data.crrm.ct_nodes=false}}});b.jstree.defaults.plugins.push("crrm")})(jQuery);
|
|
(function(b){var a=[];b.jstree._themes=false;b.jstree.plugin("themes",{__init:function(){this.get_container().bind("init.jstree",b.proxy(function(){var d=this._get_settings().themes;this.data.themes.dots=d.dots;this.data.themes.icons=d.icons;this.set_theme(d.theme,d.url)},this)).bind("loaded.jstree",b.proxy(function(){this.data.themes.dots?this.show_dots():this.hide_dots();this.data.themes.icons?this.show_icons():this.hide_icons()},this))},defaults:{theme:"default",url:false,dots:true,icons:true},
|
|
_fn:{set_theme:function(d,e){if(!d)return false;e||(e=b.jstree._themes+d+"/style.css");if(b.inArray(e,a)==-1){b.vakata.css.add_sheet({url:e,rel:"jstree"});a.push(e)}if(this.data.themes.theme!=d){this.get_container().removeClass("jstree-"+this.data.themes.theme);this.data.themes.theme=d}this.get_container().addClass("jstree-"+d);this.data.themes.dots?this.show_dots():this.hide_dots();this.data.themes.icons?this.show_icons():this.hide_icons();this.__callback()},get_theme:function(){return this.data.themes.theme},
|
|
show_dots:function(){this.data.themes.dots=true;this.get_container().children("ul").removeClass("jstree-no-dots")},hide_dots:function(){this.data.themes.dots=false;this.get_container().children("ul").addClass("jstree-no-dots")},toggle_dots:function(){this.data.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this.data.themes.icons=true;this.get_container().children("ul").removeClass("jstree-no-icons")},hide_icons:function(){this.data.themes.icons=false;this.get_container().children("ul").addClass("jstree-no-icons")},
|
|
toggle_icons:function(){this.data.themes.icons?this.hide_icons():this.show_icons()}}});b(function(){b.jstree._themes===false&&b("script").each(function(){if(this.src.toString().match(/jquery\.jstree[^\/]*?\.js(\?.*)?$/)){b.jstree._themes=this.src.toString().replace(/jquery\.jstree[^\/]*?\.js(\?.*)?$/,"")+"themes/";return false}});if(b.jstree._themes===false)b.jstree._themes="themes/"});b.jstree.defaults.plugins.push("themes")})(jQuery);
|
|
(function(b){var a=[];b.jstree.plugin("hotkeys",{__init:function(){if(typeof b.hotkeys==="undefined")throw"jsTree hotkeys: jQuery hotkeys plugin not included.";if(!this.data.ui)throw"jsTree hotkeys: jsTree UI plugin not included.";b.each(this._get_settings().hotkeys,function(d){if(b.inArray(d,a)==-1){b(document).bind("keydown",d,function(e){var g;var i=b.jstree._focused(),c;if(i&&i.data&&i.data.hotkeys&&i.data.hotkeys.enabled)if(c=i._get_settings().hotkeys[d])g=c.call(i,e);return g});a.push(d)}});
|
|
this.enable_hotkeys()},defaults:{up:function(){this.hover_node(this._get_prev(this.data.ui.hovered||this.data.ui.last_selected||-1));return false},down:function(){this.hover_node(this._get_next(this.data.ui.hovered||this.data.ui.last_selected||-1));return false},left:function(){var d=this.data.ui.hovered||this.data.ui.last_selected;if(d)d.hasClass("jstree-open")?this.close_node(d):this.hover_node(this._get_prev(d));return false},right:function(){var d=this.data.ui.hovered||this.data.ui.last_selected;
|
|
if(d&&d.length)d.hasClass("jstree-closed")?this.open_node(d):this.hover_node(this._get_next(d));return false},space:function(){this.data.ui.hovered&&this.data.ui.hovered.children("a:eq(0)").click();return false},"ctrl+space":function(d){d.type="click";this.data.ui.hovered&&this.data.ui.hovered.children("a:eq(0)").trigger(d);return false},f2:function(){this.rename(this.data.ui.hovered||this.data.ui.last_selected)},del:function(){this.remove(this.data.ui.hovered||this._get_node(null))}},_fn:{enable_hotkeys:function(){this.data.hotkeys.enabled=
|
|
true},disable_hotkeys:function(){this.data.hotkeys.enabled=false}}})})(jQuery);
|
|
(function(b){b.jstree.plugin("json_data",{defaults:{data:false,ajax:false,correct_state:true,progressive_render:false},_fn:{load_node:function(a,d,e){var g=this;this.load_node_json(a,function(){g.__callback({obj:a});d.call(this)},e)},_is_loaded:function(a){var d=this._get_settings().json_data;if((a=this._get_node(a))&&a!==-1&&d.progressive_render&&!a.is(".jstree-open, .jstree-leaf")&&a.children("ul").children("li").length===0&&a.data("jstree-children")){if(d=this._parse_json(a.data("jstree-children"))){a.append(d);
|
|
b.removeData(a,"jstree-children")}this.clean_node(a);return true}return a==-1||!a||!d.ajax||a.is(".jstree-open, .jstree-leaf")||a.children("ul").children("li").size()>0},load_node_json:function(a,d,e){var g=this.get_settings().json_data,i,c=function(){};i=function(){};if((a=this._get_node(a))&&a!==-1)if(a.data("jstree-is-loading"))return;else a.data("jstree-is-loading",true);switch(true){case !g.data&&!g.ajax:throw"Neither data nor ajax settings supplied.";case !!g.data&&!g.ajax||!!g.data&&!!g.ajax&&
|
|
(!a||a===-1):if(!a||a==-1)if(i=this._parse_json(g.data)){this.get_container().children("ul").empty().append(i.children());this.clean_node()}else g.correct_state&&this.get_container().children("ul").empty();d&&d.call(this);break;case !g.data&&!!g.ajax||!!g.data&&!!g.ajax&&a&&a!==-1:c=function(f,h,j){var l=this.get_settings().json_data.ajax.error;l&&l.call(this,f,h,j);if(a!=-1&&a.length){a.children(".jstree-loading").removeClass("jstree-loading");a.data("jstree-is-loading",false);h==="success"&&g.correct_state&&
|
|
a.removeClass("jstree-open jstree-closed").addClass("jstree-leaf")}else h==="success"&&g.correct_state&&this.get_container().children("ul").empty();e&&e.call(this)};i=function(f,h,j){var l=this.get_settings().json_data.ajax.success;if(l)f=l.call(this,f,h,j)||f;if(f===""||!b.isArray(f)&&!b.isPlainObject(f))return c.call(this,j,h,"");if(f=this._parse_json(f)){if(a===-1||!a)this.get_container().children("ul").empty().append(f.children());else{a.append(f).children(".jstree-loading").removeClass("jstree-loading");
|
|
a.data("jstree-is-loading",false)}this.clean_node(a);d&&d.call(this)}else if(a===-1||!a){if(g.correct_state){this.get_container().children("ul").empty();d&&d.call(this)}}else{a.children(".jstree-loading").removeClass("jstree-loading");a.data("jstree-is-loading",false);if(g.correct_state){a.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");d&&d.call(this)}}};g.ajax.context=this;g.ajax.error=c;g.ajax.success=i;if(!g.ajax.dataType)g.ajax.dataType="json";if(b.isFunction(g.ajax.url))g.ajax.url=
|
|
g.ajax.url.call(this,a);if(b.isFunction(g.ajax.data))g.ajax.data=g.ajax.data.call(this,a);b.ajax(g.ajax)}},_parse_json:function(a,d){var e=false,g=this._get_settings(),i=g.json_data,c=g.core.html_titles,f;if(!a)return e;if(b.isFunction(a))a=a.call(this);if(b.isArray(a)){e=b();if(!a.length)return false;g=0;for(i=a.length;g<i;g++){f=this._parse_json(a[g],true);if(f.length)e=e.add(f)}}else{if(typeof a=="string")a={data:a};if(!a.data&&a.data!=="")return e;e=b("<li>");a.attr&&e.attr(a.attr);a.metadata&&
|
|
e.data("jstree",a.metadata);a.state&&e.addClass("jstree-"+a.state);if(!b.isArray(a.data)){f=a.data;a.data=[];a.data.push(f)}b.each(a.data,function(h,j){f=b("<a>");if(b.isFunction(j))j=j.call(this,a);if(typeof j=="string")f.attr("href","#")[c?"html":"text"](j);else{if(!j.attr)j.attr={};if(!j.attr.href)j.attr.href="#";f.attr(j.attr)[c?"html":"text"](j.title);j.language&&f.addClass(j.language)}f.prepend("<ins class='jstree-icon'> </ins>");if(!j.icon&&a.icon)j.icon=a.icon;if(j.icon)j.icon.indexOf("/")===
|
|
-1?f.children("ins").addClass(j.icon):f.children("ins").css("background","url('"+j.icon+"') center center no-repeat");e.append(f)});e.prepend("<ins class='jstree-icon'> </ins>");if(a.children)if(i.progressive_render&&a.state!=="open")e.addClass("jstree-closed").data("jstree-children",a.children);else{if(b.isFunction(a.children))a.children=a.children.call(this,a);if(b.isArray(a.children)&&a.children.length){f=this._parse_json(a.children,true);if(f.length){g=b("<ul>");g.append(f);e.append(g)}}}}if(!d){g=
|
|
b("<ul>");g.append(e);e=g}return e},get_json:function(a,d,e,g){var i=[],c=this._get_settings(),f=this,h,j,l,k,m,n;a=this._get_node(a);if(!a||a===-1)a=this.get_container().find("> ul > li");d=b.isArray(d)?d:["id","class"];!g&&this.data.types&&d.push(c.types.type_attr);e=b.isArray(e)?e:[];a.each(function(){l=b(this);h={data:[]};if(d.length)h.attr={};b.each(d,function(p,o){if((j=l.attr(o))&&j.length&&j.replace(/jstree[^ ]*|$/ig,"").length)h.attr[o]=j.replace(/jstree[^ ]*|$/ig,"")});if(l.hasClass("jstree-open"))h.state=
|
|
"open";if(l.hasClass("jstree-closed"))h.state="closed";k=l.children("a");k.each(function(){m=b(this);if(e.length||b.inArray("languages",c.plugins)!==-1||m.children("ins").get(0).style.backgroundImage.length||m.children("ins").get(0).className&&m.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").length){n=false;b.inArray("languages",c.plugins)!==-1&&b.isArray(c.languages)&&c.languages.length&&b.each(c.languages,function(p,o){if(m.hasClass(o)){n=o;return false}});j={attr:{},title:f.get_text(m,
|
|
n)};b.each(e,function(p,o){h.attr[o]=(m.attr(o)||"").replace(/jstree[^ ]*|$/ig,"")});b.each(c.languages,function(p,o){if(m.hasClass(o)){j.language=o;return true}});if(m.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/^\s+$/ig,"").length)j.icon=m.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/^\s+$/ig,"");if(m.children("ins").get(0).style.backgroundImage.length)j.icon=m.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","")}else j=
|
|
f.get_text(m);if(k.length>1)h.data.push(j);else h.data=j});l=l.find("> ul > li");if(l.length)h.children=f.get_json(l,d,e,true);i.push(h)});return i}}})})(jQuery);
|
|
(function(b){b.jstree.plugin("languages",{__init:function(){this._load_css()},defaults:[],_fn:{set_lang:function(a){var d=this._get_settings().languages,e=false,g=".jstree-"+this.get_index()+" a";if(!b.isArray(d)||d.length===0)return false;if(b.inArray(a,d)==-1)if(d[a])a=d[a];else return false;if(a==this.data.languages.current_language)return true;e=b.vakata.css.get_css(g+"."+this.data.languages.current_language,false,this.data.languages.language_css);if(e!==false)e.style.display="none";e=b.vakata.css.get_css(g+
|
|
"."+a,false,this.data.languages.language_css);if(e!==false)e.style.display="";this.data.languages.current_language=a;this.__callback(a);return true},get_lang:function(){return this.data.languages.current_language},get_text:function(a,d){a=this._get_node(a)||this.data.ui.last_selected;if(!a.size())return false;var e=this._get_settings().languages,g=this._get_settings().core.html_titles;if(b.isArray(e)&&e.length){d=d&&b.inArray(d,e)!=-1?d:this.data.languages.current_language;a=a.children("a."+d)}else a=
|
|
a.children("a:eq(0)");if(g){a=a.clone();a.children("INS").remove();return a.html()}else{a=a.contents().filter(function(){return this.nodeType==3})[0];return a.nodeValue}},set_text:function(a,d,e){a=this._get_node(a)||this.data.ui.last_selected;if(!a.size())return false;var g=this._get_settings().languages,i=this._get_settings().core.html_titles;if(b.isArray(g)&&g.length){e=e&&b.inArray(e,g)!=-1?e:this.data.languages.current_language;a=a.children("a."+e)}else a=a.children("a:eq(0)");if(i){g=a.children("INS").clone();
|
|
a.html(d).prepend(g);this.__callback({obj:a,name:d,lang:e});return true}else{a=a.contents().filter(function(){return this.nodeType==3})[0];this.__callback({obj:a,name:d,lang:e});return a.nodeValue=d}},_load_css:function(){var a=this._get_settings().languages,d="/* languages css */",e=".jstree-"+this.get_index()+" a",g;if(b.isArray(a)&&a.length){this.data.languages.current_language=a[0];for(g=0;g<a.length;g++){d+=e+"."+a[g]+" {";if(a[g]!=this.data.languages.current_language)d+=" display:none; ";d+=
|
|
" } "}this.data.languages.language_css=b.vakata.css.add_sheet({str:d})}},create_node:function(a,d,e,g){return this.__call_old(true,a,d,e,function(i){var c=this._get_settings().languages,f=i.children("a"),h;if(b.isArray(c)&&c.length){for(h=0;h<c.length;h++)f.is("."+c[h])||i.append(f.eq(0).clone().removeClass(c.join(" ")).addClass(c[h]));f.not("."+c.join(", .")).remove()}g&&g.call(this,i)})}}})})(jQuery);
|
|
(function(b){b.jstree.plugin("cookies",{__init:function(){if(typeof b.cookie==="undefined")throw"jsTree cookie: jQuery cookie plugin not included.";var a=this._get_settings().cookies,d;if(a.save_opened)if((d=b.cookie(a.save_opened))&&d.length)this.data.core.to_open=d.split(",");if(a.save_selected)if((d=b.cookie(a.save_selected))&&d.length&&this.data.ui)this.data.ui.to_select=d.split(",");this.get_container().one((this.data.ui?"reselect":"reopen")+".jstree",b.proxy(function(){this.get_container().bind("open_node.jstree close_node.jstree select_node.jstree deselect_node.jstree",
|
|
b.proxy(function(e){this._get_settings().cookies.auto_save&&this.save_cookie((e.handleObj.namespace+e.handleObj.type).replace("jstree",""))},this))},this))},defaults:{save_opened:"jstree_open",save_selected:"jstree_select",auto_save:true,cookie_options:{}},_fn:{save_cookie:function(a){if(!this.data.core.refreshing){var d=this._get_settings().cookies;if(a)switch(a){case "open_node":case "close_node":if(d.save_opened){this.save_opened();b.cookie(d.save_opened,this.data.core.to_open.join(","),d.cookie_options)}break;
|
|
case "select_node":case "deselect_node":if(d.save_selected&&this.data.ui){this.save_selected();b.cookie(d.save_selected,this.data.ui.to_select.join(","),d.cookie_options)}}else{if(d.save_opened){this.save_opened();b.cookie(d.save_opened,this.data.core.to_open.join(","),d.cookie_options)}if(d.save_selected&&this.data.ui){this.save_selected();b.cookie(d.save_selected,this.data.ui.to_select.join(","),d.cookie_options)}}}}}});b.jstree.defaults.plugins.push("cookies")})(jQuery);
|
|
(function(b){b.jstree.plugin("sort",{__init:function(){this.get_container().bind("load_node.jstree",b.proxy(function(a,d){var e=this._get_node(d.rslt.obj);e=e===-1?this.get_container().children("ul"):e.children("ul");this.sort(e)},this)).bind("rename_node.jstree",b.proxy(function(a,d){this.sort(d.rslt.obj.parent())},this)).bind("move_node.jstree",b.proxy(function(a,d){this.sort((d.rslt.np==-1?this.get_container():d.rslt.np).children("ul"))},this))},defaults:function(a,d){return this.get_text(a)>this.get_text(d)?
|
|
1:-1},_fn:{sort:function(a){var d=this._get_settings().sort,e=this;a.append(b.makeArray(a.children("li")).sort(b.proxy(d,e)));a.find("> li > ul").each(function(){e.sort(b(this))});this.clean_node(a)}}})})(jQuery);
|
|
(function(b){var a=false,d=false,e=false,g=false,i=false,c=false,f=false;b.vakata.dnd={is_down:false,is_drag:false,helper:false,scroll_spd:10,init_x:0,init_y:0,threshold:5,user_data:{},drag_start:function(h,j,l){b.vakata.dnd.is_drag&&b.vakata.drag_stop({});try{h.currentTarget.unselectable="on";h.currentTarget.onselectstart=function(){return false};if(h.currentTarget.style)h.currentTarget.style.MozUserSelect="none"}catch(k){}b.vakata.dnd.init_x=h.pageX;b.vakata.dnd.init_y=h.pageY;b.vakata.dnd.user_data=
|
|
j;b.vakata.dnd.is_down=true;b.vakata.dnd.helper=b("<div id='vakata-dragged'>").html(l).css("opacity","0.75");b(document).bind("mousemove",b.vakata.dnd.drag);b(document).bind("mouseup",b.vakata.dnd.drag_stop);return false},drag:function(h){if(b.vakata.dnd.is_down){if(!b.vakata.dnd.is_drag)if(Math.abs(h.pageX-b.vakata.dnd.init_x)>5||Math.abs(h.pageY-b.vakata.dnd.init_y)>5){b.vakata.dnd.helper.appendTo("body");b.vakata.dnd.is_drag=true;b(document).triggerHandler("drag_start.vakata",{event:h,data:b.vakata.dnd.user_data})}else return;
|
|
if(h.type==="mousemove"){var j=b(document),l=j.scrollTop();j=j.scrollLeft();if(h.pageY-l<20){if(i&&c==="down"){clearInterval(i);i=false}if(!i){c="up";i=setInterval(function(){b(document).scrollTop(b(document).scrollTop()-b.vakata.dnd.scroll_spd)},150)}}else if(i&&c==="up"){clearInterval(i);i=false}if(b(window).height()-(h.pageY-l)<20){if(i&&c==="up"){clearInterval(i);i=false}if(!i){c="down";i=setInterval(function(){b(document).scrollTop(b(document).scrollTop()+b.vakata.dnd.scroll_spd)},150)}}else if(i&&
|
|
c==="down"){clearInterval(i);i=false}if(h.pageX-j<20){if(g&&f==="right"){clearInterval(g);g=false}if(!g){f="left";g=setInterval(function(){b(document).scrollLeft(b(document).scrollLeft()-b.vakata.dnd.scroll_spd)},150)}}else if(g&&f==="left"){clearInterval(g);g=false}if(b(window).width()-(h.pageX-j)<20){if(g&&f==="left"){clearInterval(g);g=false}if(!g){f="right";g=setInterval(function(){b(document).scrollLeft(b(document).scrollLeft()+b.vakata.dnd.scroll_spd)},150)}}else if(g&&f==="right"){clearInterval(g);
|
|
g=false}}b.vakata.dnd.helper.css({left:h.pageX+5+"px",top:h.pageY+10+"px"});b(document).triggerHandler("drag.vakata",{event:h,data:b.vakata.dnd.user_data})}},drag_stop:function(h){b(document).unbind("mousemove",b.vakata.dnd.drag);b(document).unbind("mouseup",b.vakata.dnd.drag_stop);b(document).triggerHandler("drag_stop.vakata",{event:h,data:b.vakata.dnd.user_data});b.vakata.dnd.helper.remove();b.vakata.dnd.init_x=0;b.vakata.dnd.init_y=0;b.vakata.dnd.user_data={};b.vakata.dnd.is_down=false;b.vakata.dnd.is_drag=
|
|
false}};b(function(){b.vakata.css.add_sheet({str:"#vakata-dragged { display:block; margin:0 0 0 0; padding:4px 4px 4px 24px; position:absolute; top:-2000px; line-height:16px; z-index:10000; } "})});b.jstree.plugin("dnd",{__init:function(){this.data.dnd={active:false,after:false,inside:false,before:false,off:false,prepared:false,w:0,to1:false,to2:false,cof:false,cw:false,ch:false,i1:false,i2:false};this.get_container().bind("mouseenter.jstree",b.proxy(function(){if(b.vakata.dnd.is_drag&&b.vakata.dnd.user_data.jstree&&
|
|
this.data.themes){e.attr("class","jstree-"+this.data.themes.theme);b.vakata.dnd.helper.attr("class","jstree-dnd-helper jstree-"+this.data.themes.theme)}},this)).bind("mouseleave.jstree",b.proxy(function(){if(b.vakata.dnd.is_drag&&b.vakata.dnd.user_data.jstree){this.data.dnd.i1&&clearInterval(this.data.dnd.i1);this.data.dnd.i2&&clearInterval(this.data.dnd.i2)}},this)).bind("mousemove.jstree",b.proxy(function(j){if(b.vakata.dnd.is_drag&&b.vakata.dnd.user_data.jstree){var l=this.get_container()[0];if(j.pageX+
|
|
24>this.data.dnd.cof.left+this.data.dnd.cw){this.data.dnd.i1&&clearInterval(this.data.dnd.i1);this.data.dnd.i1=setInterval(b.proxy(function(){this.scrollLeft+=b.vakata.dnd.scroll_spd},l),100)}else if(j.pageX-24<this.data.dnd.cof.left){this.data.dnd.i1&&clearInterval(this.data.dnd.i1);this.data.dnd.i1=setInterval(b.proxy(function(){this.scrollLeft-=b.vakata.dnd.scroll_spd},l),100)}else this.data.dnd.i1&&clearInterval(this.data.dnd.i1);if(j.pageY+24>this.data.dnd.cof.top+this.data.dnd.ch){this.data.dnd.i2&&
|
|
clearInterval(this.data.dnd.i2);this.data.dnd.i2=setInterval(b.proxy(function(){this.scrollTop+=b.vakata.dnd.scroll_spd},l),100)}else if(j.pageY-24<this.data.dnd.cof.top){this.data.dnd.i2&&clearInterval(this.data.dnd.i2);this.data.dnd.i2=setInterval(b.proxy(function(){this.scrollTop-=b.vakata.dnd.scroll_spd},l),100)}else this.data.dnd.i2&&clearInterval(this.data.dnd.i2)}},this)).delegate("a","mousedown.jstree",b.proxy(function(j){if(j.which===1){this.start_drag(j.currentTarget,j);return false}},this)).delegate("a",
|
|
"mouseenter.jstree",b.proxy(function(j){b.vakata.dnd.is_drag&&b.vakata.dnd.user_data.jstree&&this.dnd_enter(j.currentTarget)},this)).delegate("a","mousemove.jstree",b.proxy(function(j){if(b.vakata.dnd.is_drag&&b.vakata.dnd.user_data.jstree){if(typeof this.data.dnd.off.top==="undefined")this.data.dnd.off=b(j.target).offset();this.data.dnd.w=(j.pageY-(this.data.dnd.off.top||0))%this.data.core.li_height;if(this.data.dnd.w<0)this.data.dnd.w+=this.data.core.li_height;this.dnd_show()}},this)).delegate("a",
|
|
"mouseleave.jstree",b.proxy(function(j){if(b.vakata.dnd.is_drag&&b.vakata.dnd.user_data.jstree){this.data.dnd.after=false;this.data.dnd.before=false;this.data.dnd.inside=false;b.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");e.hide();if(d&&d[0]===j.target.parentNode){if(this.data.dnd.to1){clearTimeout(this.data.dnd.to1);this.data.dnd.to1=false}if(this.data.dnd.to2){clearTimeout(this.data.dnd.to2);this.data.dnd.to2=false}}}},this)).delegate("a","mouseup.jstree",b.proxy(function(j){b.vakata.dnd.is_drag&&
|
|
b.vakata.dnd.user_data.jstree&&this.dnd_finish(j)},this));b(document).bind("drag_stop.vakata",b.proxy(function(){this.data.dnd.after=false;this.data.dnd.before=false;this.data.dnd.inside=false;this.data.dnd.off=false;this.data.dnd.prepared=false;this.data.dnd.w=false;this.data.dnd.to1=false;this.data.dnd.to2=false;this.data.dnd.active=false;this.data.dnd.foreign=false;e&&e.css({top:"-2000px"})},this)).bind("drag_start.vakata",b.proxy(function(j,l){if(l.data.jstree){var k=b(l.event.target);k.closest(".jstree").hasClass("jstree-"+
|
|
this.get_index())&&this.dnd_enter(k)}},this));var h=this._get_settings().dnd;h.drag_target&&b(document).delegate(h.drag_target,"mousedown.jstree",b.proxy(function(j){a=j.target;b.vakata.dnd.drag_start(j,{jstree:true,obj:j.target},"<ins class='jstree-icon'></ins>"+b(j.target).text());if(this.data.themes){e.attr("class","jstree-"+this.data.themes.theme);b.vakata.dnd.helper.attr("class","jstree-dnd-helper jstree-"+this.data.themes.theme)}b.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
|
|
j=this.get_container();this.data.dnd.cof=j.offset();this.data.dnd.cw=parseInt(j.width(),10);this.data.dnd.ch=parseInt(j.height(),10);this.data.dnd.foreign=true;return false},this));h.drop_target&&b(document).delegate(h.drop_target,"mouseenter.jstree",b.proxy(function(j){this.data.dnd.active&&this._get_settings().dnd.drop_check.call(this,{o:a,r:b(j.target)})&&b.vakata.dnd.helper.children("ins").attr("class","jstree-ok")},this)).delegate(h.drop_target,"mouseleave.jstree",b.proxy(function(){this.data.dnd.active&&
|
|
b.vakata.dnd.helper.children("ins").attr("class","jstree-invalid")},this)).delegate(h.drop_target,"mouseup.jstree",b.proxy(function(j){this.data.dnd.active&&b.vakata.dnd.helper.children("ins").hasClass("jstree-ok")&&this._get_settings().dnd.drop_finish.call(this,{o:a,r:b(j.target)})},this))},defaults:{copy_modifier:"ctrl",check_timeout:200,open_timeout:500,drop_target:".jstree-drop",drop_check:function(){return true},drop_finish:b.noop,drag_target:".jstree-draggable",drag_finish:b.noop,drag_check:function(){return{after:false,
|
|
before:false,inside:true}}},_fn:{dnd_prepare:function(){if(d&&d.length){this.data.dnd.off=d.offset();if(this._get_settings().core.rtl)this.data.dnd.off.right=this.data.dnd.off.left+d.width();if(this.data.dnd.foreign){var h=this._get_settings().dnd.drag_check.call(this,{o:a,r:d});this.data.dnd.after=h.after;this.data.dnd.before=h.before;this.data.dnd.inside=h.inside;this.data.dnd.prepared=true;return this.dnd_show()}this.prepare_move(a,d,"before");this.data.dnd.before=this.check_move();this.prepare_move(a,
|
|
d,"after");this.data.dnd.after=this.check_move();if(this._is_loaded(d)){this.prepare_move(a,d,"inside");this.data.dnd.inside=this.check_move()}else this.data.dnd.inside=false;this.data.dnd.prepared=true;return this.dnd_show()}},dnd_show:function(){if(this.data.dnd.prepared){var h=["before","inside","after"],j=false,l=this._get_settings().core.rtl;h=this.data.dnd.w<this.data.core.li_height/3?["before","inside","after"]:this.data.dnd.w<=this.data.core.li_height*2/3?this.data.dnd.w<this.data.core.li_height/
|
|
2?["inside","before","after"]:["inside","after","before"]:["after","inside","before"];b.each(h,b.proxy(function(k,m){if(this.data.dnd[m]){b.vakata.dnd.helper.children("ins").attr("class","jstree-ok");j=m;return false}},this));j===false&&b.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");h=l?this.data.dnd.off.right-18:this.data.dnd.off.left+10;switch(j){case "before":e.css({left:h+"px",top:this.data.dnd.off.top-6+"px"}).show();break;case "after":e.css({left:h+"px",top:this.data.dnd.off.top+
|
|
this.data.core.li_height-7+"px"}).show();break;case "inside":e.css({left:h+(l?-4:4)+"px",top:this.data.dnd.off.top+this.data.core.li_height/2-5+"px"}).show();break;default:e.hide()}return j}},dnd_open:function(){this.data.dnd.to2=false;this.open_node(d,b.proxy(this.dnd_prepare,this),true)},dnd_finish:function(h){if(this.data.dnd.foreign){if(this.data.dnd.after||this.data.dnd.before||this.data.dnd.inside)this._get_settings().dnd.drag_finish.call(this,{o:a,r:d})}else{this.dnd_prepare();this.move_node(a,
|
|
d,this.dnd_show(),h[this._get_settings().dnd.copy_modifier+"Key"])}d=a=false;e.hide()},dnd_enter:function(h){var j=this._get_settings().dnd;this.data.dnd.prepared=false;d=this._get_node(h);if(j.check_timeout){this.data.dnd.to1&&clearTimeout(this.data.dnd.to1);this.data.dnd.to1=setTimeout(b.proxy(this.dnd_prepare,this),j.check_timeout)}else this.dnd_prepare();if(j.open_timeout){this.data.dnd.to2&&clearTimeout(this.data.dnd.to2);if(d&&d.length&&d.hasClass("jstree-closed"))this.data.dnd.to2=setTimeout(b.proxy(this.dnd_open,
|
|
this),j.open_timeout)}else d&&d.length&&d.hasClass("jstree-closed")&&this.dnd_open()},start_drag:function(h,j){a=this._get_node(h);if(this.data.ui&&this.is_selected(a))a=this._get_node(null,true);b.vakata.dnd.drag_start(j,{jstree:true,obj:a},"<ins class='jstree-icon'></ins>"+(a.length>1?"Multiple selection":this.get_text(a)));if(this.data.themes){e.attr("class","jstree-"+this.data.themes.theme);b.vakata.dnd.helper.attr("class","jstree-dnd-helper jstree-"+this.data.themes.theme)}var l=this.get_container();
|
|
this.data.dnd.cof=l.children("ul").offset();this.data.dnd.cw=parseInt(l.width(),10);this.data.dnd.ch=parseInt(l.height(),10);this.data.dnd.active=true}}});b(function(){b.vakata.css.add_sheet({str:"#vakata-dragged ins { display:block; text-decoration:none; width:16px; height:16px; margin:0 0 0 0; padding:0; position:absolute; top:4px; left:4px; } #vakata-dragged .jstree-ok { background:green; } #vakata-dragged .jstree-invalid { background:red; } #jstree-marker { padding:0; margin:0; line-height:12px; font-size:1px; overflow:hidden; height:12px; width:8px; position:absolute; top:-30px; z-index:10000; background-repeat:no-repeat; display:none; background-color:silver; } "});
|
|
e=b("<div>").attr({id:"jstree-marker"}).hide().appendTo("body");b(document).bind("drag_start.vakata",function(h,j){j.data.jstree&&e.show()});b(document).bind("drag_stop.vakata",function(h,j){j.data.jstree&&e.hide()})})})(jQuery);
|
|
(function(b){b.jstree.plugin("checkbox",{__init:function(){this.select_node=this.deselect_node=this.deselect_all=b.noop;this.get_selected=this.get_checked;this.get_container().bind("open_node.jstree create_node.jstree clean_node.jstree",b.proxy(function(a,d){this._prepare_checkboxes(d.rslt.obj)},this)).bind("loaded.jstree",b.proxy(function(){this._prepare_checkboxes()},this)).delegate("a","click.jstree",b.proxy(function(a){this._get_node(a.target).hasClass("jstree-checked")?this.uncheck_node(a.target):
|
|
this.check_node(a.target);this.data.ui&&this.save_selected();this.data.cookies&&this.save_cookie("select_node");a.preventDefault()},this))},__destroy:function(){this.get_container().find(".jstree-checkbox").remove()},_fn:{_prepare_checkboxes:function(a){a=!a||a==-1?this.get_container():this._get_node(a);var d,e=this,g;a.each(function(){g=b(this);d=g.is("li")&&g.hasClass("jstree-checked")?"jstree-checked":"jstree-unchecked";g.find("a").not(":has(.jstree-checkbox)").prepend("<ins class='jstree-checkbox'> </ins>").parent().not(".jstree-checked, .jstree-unchecked").addClass(d)});
|
|
a.is("li")?this._repair_state(a):a.find("> ul > li").each(function(){e._repair_state(this)})},change_state:function(a,d){a=this._get_node(a);if(d=d===false||d===true?d:a.hasClass("jstree-checked"))a.find("li").andSelf().removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");else{a.find("li").andSelf().removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");if(this.data.ui)this.data.ui.last_selected=a;this.data.checkbox.last_selected=a}a.parentsUntil(".jstree",
|
|
"li").each(function(){var e=b(this);if(d)if(e.children("ul").children(".jstree-checked, .jstree-undetermined").length){e.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");return false}else e.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");else if(e.children("ul").children(".jstree-unchecked, .jstree-undetermined").length){e.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
|
|
return false}else e.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked")});if(this.data.ui)this.data.ui.selected=this.get_checked();this.__callback(a)},check_node:function(a){this.change_state(a,false)},uncheck_node:function(a){this.change_state(a,true)},check_all:function(){var a=this;this.get_container().children("ul").children("li").each(function(){a.check_node(this,false)})},uncheck_all:function(){var a=this;this.get_container().children("ul").children("li").each(function(){a.change_state(this,
|
|
true)})},is_checked:function(a){a=this._get_node(a);return a.length?a.is(".jstree-checked"):false},get_checked:function(a){a=!a||a===-1?this.get_container():this._get_node(a);return a.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked")},get_unchecked:function(a){a=!a||a===-1?this.get_container():this._get_node(a);return a.find("> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked")},show_checkboxes:function(){this.get_container().children("ul").removeClass("jstree-no-checkboxes")},
|
|
hide_checkboxes:function(){this.get_container().children("ul").addClass("jstree-no-checkboxes")},_repair_state:function(a){a=this._get_node(a);if(a.length){var d=a.find("> ul > .jstree-checked").length,e=a.find("> ul > .jstree-undetermined").length,g=a.find("> ul > li").length;if(g===0)a.hasClass("jstree-undetermined")&&this.check_node(a);else if(d===0&&e===0)this.uncheck_node(a);else d===g?this.check_node(a):a.parentsUntil(".jstree","li").removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined")}},
|
|
reselect:function(){if(this.data.ui){var a=this,d=this.data.ui.to_select;d=b.map(b.makeArray(d),function(e){return"#"+e.toString().replace(/^#/,"").replace("\\/","/").replace("/","\\/")});this.deselect_all();b.each(d,function(e,g){a.check_node(g)});this.__callback()}}}})})(jQuery);
|
|
(function(b){b.vakata.xslt=function(d,e,g){var i="",c;if(document.recalc){c=document.createElement("xml");i=document.createElement("xml");c.innerHTML=d;i.innerHTML=e;b("body").append(c).append(i);setTimeout(function(f,h,j){return function(){j.call(null,f.transformNode(h.XMLDocument));setTimeout(function(l,k){return function(){jQuery("body").remove(l).remove(k)}}(f,h),200)}}(c,i,g),100);return true}if(typeof window.DOMParser!=="undefined"&&typeof window.XMLHttpRequest!=="undefined"&&typeof window.XSLTProcessor!==
|
|
"undefined"){c=new XSLTProcessor;i=b.isFunction(c.transformDocument)?typeof window.XMLSerializer!=="undefined":true;if(!i)return false;d=(new DOMParser).parseFromString(d,"text/xml");e=(new DOMParser).parseFromString(e,"text/xml");if(b.isFunction(c.transformDocument)){i=document.implementation.createDocument("","",null);c.transformDocument(d,e,i,null);g.call(null,XMLSerializer().serializeToString(i))}else{c.importStylesheet(e);i=c.transformToFragment(d,document);g.call(null,b("<div>").append(i).html())}return true}return false};
|
|
var a={nest:'<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/html" /><xsl:template match="/">\t<xsl:call-template name="nodes">\t\t<xsl:with-param name="node" select="/root" />\t</xsl:call-template></xsl:template><xsl:template name="nodes">\t<xsl:param name="node" />\t<ul>\t<xsl:for-each select="$node/item">\t\t<xsl:variable name="children" select="count(./item) > 0" />\t\t<li>\t\t\t<xsl:attribute name="class">\t\t\t\t<xsl:if test="position() = last()">jstree-last </xsl:if>\t\t\t\t<xsl:choose>\t\t\t\t\t<xsl:when test="@state = \'open\'">jstree-open </xsl:when>\t\t\t\t\t<xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>\t\t\t\t\t<xsl:otherwise>jstree-leaf </xsl:otherwise>\t\t\t\t</xsl:choose>\t\t\t\t<xsl:value-of select="@class" />\t\t\t</xsl:attribute>\t\t\t<xsl:for-each select="@*">\t\t\t\t<xsl:if test="name() != \'class\' and name() != \'state\' and name() != \'hasChildren\'">\t\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t\t</xsl:if>\t\t\t</xsl:for-each>\t<ins class="jstree-icon"><xsl:text> </xsl:text></ins>\t\t\t<xsl:for-each select="content/name">\t\t\t\t<a>\t\t\t\t<xsl:attribute name="href">\t\t\t\t\t<xsl:choose>\t\t\t\t\t<xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>\t\t\t\t\t<xsl:otherwise>#</xsl:otherwise>\t\t\t\t\t</xsl:choose>\t\t\t\t</xsl:attribute>\t\t\t\t<xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>\t\t\t\t<xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>\t\t\t\t<xsl:for-each select="@*">\t\t\t\t\t<xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">\t\t\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t\t\t</xsl:if>\t\t\t\t</xsl:for-each>\t\t\t\t\t<ins>\t\t\t\t\t\t<xsl:attribute name="class">jstree-icon \t\t\t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>\t\t\t\t\t\t</xsl:attribute>\t\t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>\t\t\t\t\t\t<xsl:text> </xsl:text>\t\t\t\t\t</ins>\t\t\t\t\t<xsl:value-of select="current()" />\t\t\t\t</a>\t\t\t</xsl:for-each>\t\t\t<xsl:if test="$children or @hasChildren"><xsl:call-template name="nodes"><xsl:with-param name="node" select="current()" /></xsl:call-template></xsl:if>\t\t</li>\t</xsl:for-each>\t</ul></xsl:template></xsl:stylesheet>',
|
|
flat:'<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/xml" /><xsl:template match="/">\t<ul>\t<xsl:for-each select="//item[not(@parent_id) or @parent_id=0 or not(@parent_id = //item/@id)]">\t\t<xsl:call-template name="nodes">\t\t\t<xsl:with-param name="node" select="." />\t\t\t<xsl:with-param name="is_last" select="number(position() = last())" />\t\t</xsl:call-template>\t</xsl:for-each>\t</ul></xsl:template><xsl:template name="nodes">\t<xsl:param name="node" />\t<xsl:param name="is_last" />\t<xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) > 0" />\t<li>\t<xsl:attribute name="class">\t\t<xsl:if test="$is_last = true()">jstree-last </xsl:if>\t\t<xsl:choose>\t\t\t<xsl:when test="@state = \'open\'">jstree-open </xsl:when>\t\t\t<xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>\t\t\t<xsl:otherwise>jstree-leaf </xsl:otherwise>\t\t</xsl:choose>\t\t<xsl:value-of select="@class" />\t</xsl:attribute>\t<xsl:for-each select="@*">\t\t<xsl:if test="name() != \'parent_id\' and name() != \'hasChildren\' and name() != \'class\' and name() != \'state\'">\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t</xsl:if>\t</xsl:for-each>\t<ins class="jstree-icon"><xsl:text> </xsl:text></ins>\t<xsl:for-each select="content/name">\t\t<a>\t\t<xsl:attribute name="href">\t\t\t<xsl:choose>\t\t\t<xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>\t\t\t<xsl:otherwise>#</xsl:otherwise>\t\t\t</xsl:choose>\t\t</xsl:attribute>\t\t<xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>\t\t<xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>\t\t<xsl:for-each select="@*">\t\t\t<xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t</xsl:if>\t\t</xsl:for-each>\t\t\t<ins>\t\t\t\t<xsl:attribute name="class">jstree-icon \t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>\t\t\t\t</xsl:attribute>\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>\t\t\t\t<xsl:text> </xsl:text>\t\t\t</ins>\t\t\t<xsl:value-of select="current()" />\t\t</a>\t</xsl:for-each>\t<xsl:if test="$children">\t\t<ul>\t\t<xsl:for-each select="//item[@parent_id=$node/attribute::id]">\t\t\t<xsl:call-template name="nodes">\t\t\t\t<xsl:with-param name="node" select="." />\t\t\t\t<xsl:with-param name="is_last" select="number(position() = last())" />\t\t\t</xsl:call-template>\t\t</xsl:for-each>\t\t</ul>\t</xsl:if>\t</li></xsl:template></xsl:stylesheet>'};
|
|
b.jstree.plugin("xml_data",{defaults:{data:false,ajax:false,xsl:"flat",clean_node:false,correct_state:true},_fn:{load_node:function(d,e,g){var i=this;this.load_node_xml(d,function(){i.__callback({obj:d});e.call(this)},g)},_is_loaded:function(d){var e=this._get_settings().xml_data;d=this._get_node(d);return d==-1||!d||!e.ajax||d.is(".jstree-open, .jstree-leaf")||d.children("ul").children("li").size()>0},load_node_xml:function(d,e,g){var i=this.get_settings().xml_data,c=function(){},f=function(){};
|
|
if((d=this._get_node(d))&&d!==-1)if(d.data("jstree-is-loading"))return;else d.data("jstree-is-loading",true);switch(true){case !i.data&&!i.ajax:throw"Neither data nor ajax settings supplied.";case !!i.data&&!i.ajax||!!i.data&&!!i.ajax&&(!d||d===-1):if(!d||d==-1)this.parse_xml(i.data,b.proxy(function(h){if(h){h=h.replace(/ ?xmlns="[^"]*"/ig,"");if(h.length>10){h=b(h);this.get_container().children("ul").empty().append(h.children());i.clean_node&&this.clean_node(d);e&&e.call(this)}}else if(i.correct_state){this.get_container().children("ul").empty();
|
|
e&&e.call(this)}},this));break;case !i.data&&!!i.ajax||!!i.data&&!!i.ajax&&d&&d!==-1:c=function(h,j,l){var k=this.get_settings().xml_data.ajax.error;k&&k.call(this,h,j,l);if(d!==-1&&d.length){d.children(".jstree-loading").removeClass("jstree-loading");d.data("jstree-is-loading",false);j==="success"&&i.correct_state&&d.removeClass("jstree-open jstree-closed").addClass("jstree-leaf")}else j==="success"&&i.correct_state&&this.get_container().children("ul").empty();g&&g.call(this)};f=function(h,j,l){h=
|
|
l.responseText;var k=this.get_settings().xml_data.ajax.success;if(k)h=k.call(this,h,j,l)||h;if(h=="")return c.call(this,l,j,"");this.parse_xml(h,b.proxy(function(m){if(m){m=m.replace(/ ?xmlns="[^"]*"/ig,"");if(m.length>10){m=b(m);if(d===-1||!d)this.get_container().children("ul").empty().append(m.children());else{d.children(".jstree-loading").removeClass("jstree-loading");d.append(m);d.data("jstree-is-loading",false)}i.clean_node&&this.clean_node(d);e&&e.call(this)}else if(d&&d!==-1){d.children(".jstree-loading").removeClass("jstree-loading");
|
|
d.data("jstree-is-loading",false);if(i.correct_state){d.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");e&&e.call(this)}}else if(i.correct_state){this.get_container().children("ul").empty();e&&e.call(this)}}},this))};i.ajax.context=this;i.ajax.error=c;i.ajax.success=f;if(!i.ajax.dataType)i.ajax.dataType="xml";if(b.isFunction(i.ajax.url))i.ajax.url=i.ajax.url.call(this,d);if(b.isFunction(i.ajax.data))i.ajax.data=i.ajax.data.call(this,d);b.ajax(i.ajax)}},parse_xml:function(d,e){var g=
|
|
this._get_settings().xml_data;b.vakata.xslt(d,a[g.xsl],e)},get_xml:function(d,e,g,i,c){var f="",h=this._get_settings(),j=this,l,k,m,n,p;d||(d="flat");c||(c=0);e=this._get_node(e);if(!e||e===-1)e=this.get_container().find("> ul > li");g=b.isArray(g)?g:["id","class"];!c&&this.data.types&&b.inArray(h.types.type_attr,g)===-1&&g.push(h.types.type_attr);i=b.isArray(i)?i:[];c||(f+="<root>");e.each(function(){f+="<item";m=b(this);b.each(g,function(o,q){f+=" "+q+'="'+(m.attr(q)||"").replace(/jstree[^ ]*|$/ig,
|
|
"").replace(/^\s+$/ig,"")+'"'});if(m.hasClass("jstree-open"))f+=' state="open"';if(m.hasClass("jstree-closed"))f+=' state="closed"';if(d==="flat")f+=' parent_id="'+c+'"';f+=">";f+="<content>";n=m.children("a");n.each(function(){l=b(this);p=false;f+="<name";b.inArray("languages",h.plugins)!==-1&&b.each(h.languages,function(o,q){if(l.hasClass(q)){f+=' lang="'+q+'"';p=q;return false}});i.length&&b.each(i,function(o,q){f+=" "+q+'="'+(l.attr(q)||"").replace(/jstree[^ ]*|$/ig,"")+'"'});if(l.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,
|
|
"").replace(/^\s+$/ig,"").length)f+=' icon="'+l.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/^\s+$/ig,"")+'"';if(l.children("ins").get(0).style.backgroundImage.length)f+=' icon="'+l.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","")+'"';f+=">";f+="<![CDATA["+j.get_text(l,p)+"]]\>";f+="</name>"});f+="</content>";k=m[0].id;m=m.find("> ul > li");k=m.length?j.get_xml(d,m,g,i,k):"";if(d=="nest")f+=k;f+="</item>";if(d=="flat")f+=k});c||(f+="</root>");
|
|
return f}}})})(jQuery);
|
|
(function(b){b.expr[":"].jstree_contains=function(a,d,e){return(a.textContent||a.innerText||"").toLowerCase().indexOf(e[3].toLowerCase())>=0};b.jstree.plugin("search",{__init:function(){this.data.search.str="";this.data.search.result=b()},defaults:{ajax:false,case_insensitive:false},_fn:{search:function(a,d){if(a!==""){var e=this.get_settings().search,g=this,i=function(){},c=function(){};this.data.search.str=a;if(!d&&e.ajax!==false&&this.get_container().find(".jstree-closed:eq(0)").length>0){this.search.supress_callback=
|
|
true;i=function(){};c=function(f,h,j){var l=this.get_settings().search.ajax.success;if(l)f=l.call(this,f,h,j)||f;this.data.search.to_open=f;this._search_open()};e.ajax.context=this;e.ajax.error=i;e.ajax.success=c;if(b.isFunction(e.ajax.url))e.ajax.url=e.ajax.url.call(this,a);if(b.isFunction(e.ajax.data))e.ajax.data=e.ajax.data.call(this,a);if(!e.ajax.data)e.ajax.data={search_string:a};if(!e.ajax.dataType||/^json/.exec(e.ajax.dataType))e.ajax.dataType="json";b.ajax(e.ajax)}else{this.data.search.result.length&&
|
|
this.clear_search();this.data.search.result=this.get_container().find("a"+(this.data.languages?"."+this.get_lang():"")+":"+(e.case_insensitive?"jstree_contains":"contains")+"("+this.data.search.str+")");this.data.search.result.addClass("jstree-search").parents(".jstree-closed").each(function(){g.open_node(this,false,true)});this.__callback({nodes:this.data.search.result,str:a})}}},clear_search:function(){this.data.search.result.removeClass("jstree-search");this.__callback(this.data.search.result);
|
|
this.data.search.result=b()},_search_open:function(){var a=this,d=true,e=[],g=[];if(this.data.search.to_open.length){b.each(this.data.search.to_open,function(i,c){if(c=="#")return true;b(c).length&&b(c).is(".jstree-closed")?e.push(c):g.push(c)});if(e.length){this.data.search.to_open=g;b.each(e,function(i,c){a.open_node(c,function(){a._search_open(true)})});d=false}}d&&this.search(this.data.search.str,true)}}})})(jQuery);
|
|
(function(b){b.vakata.context={cnt:b("<div id='vakata-contextmenu'>"),vis:false,tgt:false,par:false,func:false,data:false,show:function(a,d,e,g,i,c){if(a=b.vakata.context.parse(a)){b.vakata.context.vis=true;b.vakata.context.tgt=d;b.vakata.context.par=c||d||null;b.vakata.context.data=i||null;b.vakata.context.cnt.html(a).css({visibility:"hidden",display:"block",left:0,top:0});i=b.vakata.context.cnt.height();c=b.vakata.context.cnt.width();if(e+c>b(document).width()){e=b(document).width()-(c+5);b.vakata.context.cnt.find("li > ul").addClass("right")}if(g+
|
|
i>b(document).height()){g-=i+d[0].offsetHeight;b.vakata.context.cnt.find("li > ul").addClass("bottom")}b.vakata.context.cnt.css({left:e,top:g}).find("li:has(ul)").bind("mouseenter",function(){var f=b(document).width(),h=b(document).height(),j=b(this).children("ul").show();f!==b(document).width()&&j.toggleClass("right");h!==b(document).height()&&j.toggleClass("bottom")}).bind("mouseleave",function(){b(this).children("ul").hide()}).end().css({visibility:"visible"}).show();b(document).triggerHandler("context_show.vakata")}},
|
|
hide:function(){b.vakata.context.vis=false;b.vakata.context.cnt.attr("class","").hide();b(document).triggerHandler("context_hide.vakata")},parse:function(a,d){if(!a)return false;var e="",g=false,i=true;if(!d)b.vakata.context.func={};e+="<ul>";b.each(a,function(c,f){if(!f)return true;b.vakata.context.func[c]=f.action;if(!i&&f.separator_before)e+="<li class='vakata-separator vakata-separator-before'></li>";i=false;e+="<li class='"+(f._class||"")+(f._disabled?" jstree-contextmenu-disabled ":"")+"'><ins ";
|
|
if(f.icon&&f.icon.indexOf("/")===-1)e+=" class='"+f.icon+"' ";if(f.icon&&f.icon.indexOf("/")!==-1)e+=" style='background:url("+f.icon+") center center no-repeat;' ";e+="> </ins><a href='#' rel='"+c+"'>";if(f.submenu)e+="<span style='float:right;'>»</span>";e+=f.label+"</a>";if(f.submenu)if(g=b.vakata.context.parse(f.submenu,true))e+=g;e+="</li>";if(f.separator_after){e+="<li class='vakata-separator vakata-separator-after'></li>";i=true}});e=e.replace(/<li class\='vakata-separator vakata-separator-after'\><\/li\>$/,
|
|
"");e+="</ul>";return e.length>10?e:false},exec:function(a){if(b.isFunction(b.vakata.context.func[a])){b.vakata.context.func[a].call(b.vakata.context.data,b.vakata.context.par);return true}else return false}};b(function(){b.vakata.css.add_sheet({str:"#vakata-contextmenu { display:none; position:absolute; margin:0; padding:0; min-width:180px; background:#ebebeb; border:1px solid silver; z-index:10000; *width:180px; } #vakata-contextmenu ul { min-width:180px; *width:180px; } #vakata-contextmenu ul, #vakata-contextmenu li { margin:0; padding:0; list-style-type:none; display:block; } #vakata-contextmenu li { line-height:20px; min-height:20px; position:relative; padding:0px; } #vakata-contextmenu li a { padding:1px 6px; line-height:17px; display:block; text-decoration:none; margin:1px 1px 0 1px; } #vakata-contextmenu li ins { float:left; width:16px; height:16px; text-decoration:none; margin-right:2px; } #vakata-contextmenu li a:hover, #vakata-contextmenu li.vakata-hover > a { background:gray; color:white; } #vakata-contextmenu li ul { display:none; position:absolute; top:-2px; left:100%; background:#ebebeb; border:1px solid gray; } #vakata-contextmenu .right { right:100%; left:auto; } #vakata-contextmenu .bottom { bottom:-1px; top:auto; } #vakata-contextmenu li.vakata-separator { min-height:0; height:1px; line-height:1px; font-size:1px; overflow:hidden; margin:0 2px; background:silver; /* border-top:1px solid #fefefe; */ padding:0; } "});
|
|
b.vakata.context.cnt.delegate("a","click",function(a){a.preventDefault()}).delegate("a","mouseup",function(){!b(this).parent().hasClass("jstree-contextmenu-disabled")&&b.vakata.context.exec(b(this).attr("rel"))?b.vakata.context.hide():b(this).blur()}).delegate("a","mouseover",function(){b.vakata.context.cnt.find(".vakata-hover").removeClass("vakata-hover")}).appendTo("body");b(document).bind("mousedown",function(a){b.vakata.context.vis&&!b.contains(b.vakata.context.cnt[0],a.target)&&b.vakata.context.hide()});
|
|
typeof b.hotkeys!=="undefined"&&b(document).bind("keydown","up",function(a){if(b.vakata.context.vis){var d=b.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").prevAll("li:not(.vakata-separator)").first();d.length||(d=b.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").last());d.addClass("vakata-hover");a.stopImmediatePropagation();a.preventDefault()}}).bind("keydown","down",function(a){if(b.vakata.context.vis){var d=
|
|
b.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").nextAll("li:not(.vakata-separator)").first();d.length||(d=b.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").first());d.addClass("vakata-hover");a.stopImmediatePropagation();a.preventDefault()}}).bind("keydown","right",function(a){if(b.vakata.context.vis){b.vakata.context.cnt.find(".vakata-hover").children("ul").show().children("li:not(.vakata-separator)").removeClass("vakata-hover").first().addClass("vakata-hover");
|
|
a.stopImmediatePropagation();a.preventDefault()}}).bind("keydown","left",function(a){if(b.vakata.context.vis){b.vakata.context.cnt.find(".vakata-hover").children("ul").hide().children(".vakata-separator").removeClass("vakata-hover");a.stopImmediatePropagation();a.preventDefault()}}).bind("keydown","esc",function(a){b.vakata.context.hide();a.preventDefault()}).bind("keydown","space",function(a){b.vakata.context.cnt.find(".vakata-hover").last().children("a").click();a.preventDefault()})});b.jstree.plugin("contextmenu",
|
|
{__init:function(){this.get_container().delegate("a","contextmenu.jstree",b.proxy(function(a){a.preventDefault();this.show_contextmenu(a.currentTarget,a.pageX,a.pageY)},this)).bind("destroy.jstree",b.proxy(function(){this.data.contextmenu&&b.vakata.context.hide()},this));b(document).bind("context_hide.vakata",b.proxy(function(){this.data.contextmenu=false},this))},defaults:{select_node:false,show_at_node:true,items:{create:{separator_before:false,separator_after:true,label:"Create",action:function(a){this.create(a)}},
|
|
rename:{separator_before:false,separator_after:false,label:"Rename",action:function(a){this.rename(a)}},remove:{separator_before:false,icon:false,separator_after:false,label:"Delete",action:function(a){this.remove(a)}},ccp:{separator_before:true,icon:false,separator_after:false,label:"Edit",action:false,submenu:{cut:{separator_before:false,separator_after:false,label:"Cut",action:function(a){this.cut(a)}},copy:{separator_before:false,icon:false,separator_after:false,label:"Copy",action:function(a){this.copy(a)}},
|
|
paste:{separator_before:false,icon:false,separator_after:false,label:"Paste",action:function(a){this.paste(a)}}}}}},_fn:{show_contextmenu:function(a,d,e){a=this._get_node(a);var g=this.get_settings().contextmenu,i=a.children("a:visible:eq(0)"),c=false;if(g.select_node&&this.data.ui&&!this.is_selected(a)){this.deselect_all();this.select_node(a,true)}if(g.show_at_node||typeof d==="undefined"||typeof e==="undefined"){c=i.offset();d=c.left;e=c.top+this.data.core.li_height}if(b.isFunction(g.items))g.items=
|
|
g.items.call(this,a);this.data.contextmenu=true;b.vakata.context.show(g.items,i,d,e,this,a);this.data.themes&&b.vakata.context.cnt.attr("class","jstree-"+this.data.themes.theme+"-context")}}})})(jQuery);
|
|
(function(b){b.jstree.plugin("types",{__init:function(){var a=this._get_settings().types;this.data.types.attach_to=[];this.get_container().bind("init.jstree",b.proxy(function(){var d=a.type_attr,e="",g=this;b.each(a.types,function(i,c){b.each(c,function(f){/^(max_depth|max_children|icon|valid_children)$/.test(f)||g.data.types.attach_to.push(f)});if(!c.icon)return true;if(c.icon.image||c.icon.position){e+=i=="default"?".jstree-"+g.get_index()+" a > .jstree-icon { ":".jstree-"+g.get_index()+" li["+
|
|
d+"="+i+"] > a > .jstree-icon { ";if(c.icon.image)e+=" background-image:url("+c.icon.image+"); ";e+=c.icon.position?" background-position:"+c.icon.position+"; ":" background-position:0 0; ";e+="} "}});e!=""&&b.vakata.css.add_sheet({str:e})},this)).bind("before.jstree",b.proxy(function(d,e){if(b.inArray(e.func,this.data.types.attach_to)!==-1){var g=this._get_settings().types.types,i=this._get_type(e.args[0]);if((g[i]&&typeof g[i][e.func]!=="undefined"||g["default"]&&typeof g["default"][e.func]!=="undefined")&&
|
|
!this._check(e.func,e.args[0])){d.stopImmediatePropagation();return false}}},this))},defaults:{max_children:-1,max_depth:-1,valid_children:"all",type_attr:"rel",types:{"default":{max_children:-1,max_depth:-1,valid_children:"all"}}},_fn:{_get_type:function(a){a=this._get_node(a);return!a||!a.length?false:a.attr(this._get_settings().types.type_attr)||"default"},set_type:function(a,d){d=this._get_node(d);return!d.length||!a?false:d.attr(this._get_settings().types.type_attr,a)},_check:function(a,d,e){var g=
|
|
false,i=this._get_type(d),c=0,f=this,h=this._get_settings().types;if(d===-1)if(h[a])g=h[a];else return;else{if(i===false)return;if(h.types[i]&&h.types[i][a])g=h.types[i][a];else if(h.types["default"]&&h.types["default"][a])g=h.types["default"][a]}if(b.isFunction(g))g=g.call(this,d);a==="max_depth"&&d!==-1&&e!==false&&h.max_depth!==-2&&g!==0&&this._get_node(d).children("a:eq(0)").parentsUntil(".jstree","li").each(function(j){if(h.max_depth!==-1&&h.max_depth-(j+1)<=0){g=0;return false}c=j===0?g:f._check(a,
|
|
this,false);if(c!==-1&&c-(j+1)<=0){g=0;return false}if(c>=0&&(c-(j+1)<g||g<0))g=c-(j+1);if(h.max_depth>=0&&(h.max_depth-(j+1)<g||g<0))g=h.max_depth-(j+1)});return g},check_move:function(){if(!this.__call_old())return false;var a=this._get_move(),d=a.rt._get_settings().types,e=a.rt._check("max_children",a.cr),g=a.rt._check("max_depth",a.cr),i=a.rt._check("valid_children",a.cr),c=0,f=1;if(i==="none")return false;if(b.isArray(i)&&a.ot&&a.ot._get_type){a.o.each(function(){if(b.inArray(a.ot._get_type(this),
|
|
i)===-1)return f=false});if(f===false)return false}if(d.max_children!==-2&&e!==-1){c=a.cr===-1?this.get_container().children("> ul > li").not(a.o).length:a.cr.children("> ul > li").not(a.o).length;if(c+a.o.length>e)return false}if(d.max_depth!==-2&&g!==-1){f=0;if(g===0)return false;if(typeof a.o.d==="undefined"){for(d=a.o;d.length>0;){d=d.find("> ul > li");f++}a.o.d=f}if(g-a.o.d<0)return false}return true},create_node:function(a,d,e,g,i,c){if(!c&&(i||this._is_loaded(a))){var f=d&&d.match(/^before|after$/i)&&
|
|
a!==-1?this._get_parent(a):this._get_node(a),h=this._get_settings().types,j=this._check("max_children",f),l=this._check("max_depth",f),k=this._check("valid_children",f);e||(e={});if(k==="none")return false;if(b.isArray(k))if(!e.attr||!e.attr[h.type_attr]){if(!e.attr)e.attr={};e.attr[h.type_attr]=k[0]}else if(b.inArray(e.attr[h.type_attr],k)===-1)return false;if(h.max_children!==-2&&j!==-1){f=f===-1?this.get_container().children("> ul > li").length:f.children("> ul > li").length;if(f+1>j)return false}if(h.max_depth!==
|
|
-2&&l!==-1&&l-1<0)return false}return this.__call_old(true,a,d,e,g,i,c)}}})})(jQuery);
|
|
(function(b){b.jstree.plugin("html_data",{__init:function(){this.data.html_data.original_container_html=this.get_container().find(" > ul > li").clone(true);this.data.html_data.original_container_html.find("li").andSelf().contents().filter(function(){return this.nodeType==3}).remove()},defaults:{data:false,ajax:false,correct_state:true},_fn:{load_node:function(a,d,e){var g=this;this.load_node_html(a,function(){g.__callback({obj:a});d.call(this)},e)},_is_loaded:function(a){a=this._get_node(a);return a==
|
|
-1||!a||!this._get_settings().html_data.ajax||a.is(".jstree-open, .jstree-leaf")||a.children("ul").children("li").size()>0},load_node_html:function(a,d,e){var g,i=this.get_settings().html_data,c=function(){};g=function(){};if((a=this._get_node(a))&&a!==-1)if(a.data("jstree-is-loading"))return;else a.data("jstree-is-loading",true);switch(true){case !i.data&&!i.ajax:if(!a||a==-1){this.get_container().children("ul").empty().append(this.data.html_data.original_container_html).find("li, a").filter(function(){return this.firstChild.tagName!==
|
|
"INS"}).prepend("<ins class='jstree-icon'> </ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");this.clean_node()}d&&d.call(this);break;case !!i.data&&!i.ajax||!!i.data&&!!i.ajax&&(!a||a===-1):if(!a||a==-1){g=b(i.data);g.is("ul")||(g=b("<ul>").append(g));this.get_container().children("ul").empty().append(g.children()).find("li, a").filter(function(){return this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'> </ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");
|
|
this.clean_node()}d&&d.call(this);break;case !i.data&&!!i.ajax||!!i.data&&!!i.ajax&&a&&a!==-1:a=this._get_node(a);c=function(f,h,j){var l=this.get_settings().html_data.ajax.error;l&&l.call(this,f,h,j);if(a!=-1&&a.length){a.children(".jstree-loading").removeClass("jstree-loading");a.data("jstree-is-loading",false);h==="success"&&i.correct_state&&a.removeClass("jstree-open jstree-closed").addClass("jstree-leaf")}else h==="success"&&i.correct_state&&this.get_container().children("ul").empty();e&&e.call(this)};
|
|
g=function(f,h,j){var l=this.get_settings().html_data.ajax.success;if(l)f=l.call(this,f,h,j)||f;if(f=="")return c.call(this,j,h,"");if(f){f=b(f);f.is("ul")||(f=b("<ul>").append(f));if(a==-1||!a)this.get_container().children("ul").empty().append(f.children()).find("li, a").filter(function(){return this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'> </ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");else{a.children(".jstree-loading").removeClass("jstree-loading");
|
|
a.append(f).find("li, a").filter(function(){return this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'> </ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");a.data("jstree-is-loading",false)}this.clean_node(a);d&&d.call(this)}else if(a&&a!==-1){a.children(".jstree-loading").removeClass("jstree-loading");a.data("jstree-is-loading",false);if(i.correct_state){a.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");d&&d.call(this)}}else if(i.correct_state){this.get_container().children("ul").empty();
|
|
d&&d.call(this)}};i.ajax.context=this;i.ajax.error=c;i.ajax.success=g;if(!i.ajax.dataType)i.ajax.dataType="html";if(b.isFunction(i.ajax.url))i.ajax.url=i.ajax.url.call(this,a);if(b.isFunction(i.ajax.data))i.ajax.data=i.ajax.data.call(this,a);b.ajax(i.ajax)}}}});b.jstree.defaults.plugins.push("html_data")})(jQuery);
|
|
(function(b){b.jstree.plugin("themeroller",{__init:function(){var a=this._get_settings().themeroller;this.get_container().addClass("ui-widget-content").delegate("a","mouseenter.jstree",function(){b(this).addClass(a.item_h)}).delegate("a","mouseleave.jstree",function(){b(this).removeClass(a.item_h)}).bind("open_node.jstree create_node.jstree",b.proxy(function(d,e){this._themeroller(e.rslt.obj)},this)).bind("loaded.jstree refresh.jstree",b.proxy(function(){this._themeroller()},this)).bind("close_node.jstree",
|
|
b.proxy(function(d,e){e.rslt.obj.children("ins").removeClass(a.opened).addClass(a.closed)},this)).bind("select_node.jstree",b.proxy(function(d,e){e.rslt.obj.children("a").addClass(a.item_a)},this)).bind("deselect_node.jstree deselect_all.jstree",b.proxy(function(){this.get_container().find("."+a.item_a).removeClass(a.item_a).end().find(".jstree-clicked").addClass(a.item_a)},this)).bind("move_node.jstree",b.proxy(function(d,e){this._themeroller(e.rslt.o)},this))},__destroy:function(){var a=this._get_settings().themeroller,
|
|
d=["ui-icon"];b.each(a,function(e,g){g=g.split(" ");if(g.length)d=d.concat(g)});this.get_container().removeClass("ui-widget-content").find("."+d.join(", .")).removeClass(d.join(" "))},_fn:{_themeroller:function(a){var d=this._get_settings().themeroller;a=!a||a==-1?this.get_container():this._get_node(a).parent();a.find("li.jstree-closed > ins.jstree-icon").removeClass(d.opened).addClass("ui-icon "+d.closed).end().find("li.jstree-open > ins.jstree-icon").removeClass(d.closed).addClass("ui-icon "+d.opened).end().find("a").addClass(d.item).children("ins.jstree-icon").addClass("ui-icon "+
|
|
d.item_icon)}},defaults:{opened:"ui-icon-triangle-1-se",closed:"ui-icon-triangle-1-e",item:"ui-state-default",item_h:"ui-state-hover",item_a:"ui-state-active",item_icon:"ui-icon-folder-collapsed"}});b(function(){b.vakata.css.add_sheet({str:".jstree .ui-icon { overflow:visible; } .jstree a { padding:0 2px; }"})})})(jQuery);
|
|
(function(b){b.jstree.plugin("unique",{__init:function(){this.get_container().bind("before.jstree",b.proxy(function(a,d){var e=[],g=true,i;if(d.func=="move_node")if(d.args[4]===true)if(d.args[0].o&&d.args[0].o.length){d.args[0].o.children("a").each(function(){e.push(b(this).text().replace(/^\s+/g,""))});g=this._check_unique(e,d.args[0].np.find("> ul > li").not(d.args[0].o))}if(d.func=="create_node")if(d.args[4]||this._is_loaded(d.args[0])){g=this._get_node(d.args[0]);if(d.args[1]&&(d.args[1]==="before"||
|
|
d.args[1]==="after")){g=this._get_parent(d.args[0]);if(!g||g===-1)g=this.get_container()}if(typeof d.args[2]==="string")e.push(d.args[2]);else!d.args[2]||!d.args[2].data?e.push(this._get_settings().core.strings.new_node):e.push(d.args[2].data);g=this._check_unique(e,g.find("> ul > li"))}if(d.func=="rename_node"){e.push(d.args[1]);i=this._get_node(d.args[0]);g=this._get_parent(i);if(!g||g===-1)g=this.get_container();g=this._check_unique(e,g.find("> ul > li").not(i))}if(!g){a.stopPropagation();return false}},
|
|
this))},_fn:{_check_unique:function(a,d){var e=[];d.children("a").each(function(){e.push(b(this).text().replace(/^\s+/g,""))});if(!e.length||!a.length)return true;e=e.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");if(e.length+a.length!=e.concat(a).sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",").length)return false;return true},check_move:function(){if(!this.__call_old())return false;
|
|
var a=this._get_move(),d=[];if(a.o&&a.o.length){a.o.children("a").each(function(){d.push(b(this).text().replace(/^\s+/g,""))});return this._check_unique(d,a.np.find("> ul > li").not(a.o))}return true}}})})(jQuery);
|