From be00deede79dcc0845281e8f22a86fe9b565b306 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 7 Oct 2011 11:57:59 +1100 Subject: [PATCH] Update jstree.jquery to 1.0rc3 --- .../controller/lnapp/templatedefault.php | 4 +- application/classes/controller/lnapp/tree.php | 14 +- application/media/css/jquery.jstree.css | 56 - application/media/js/jquery.jstree-1.0rc.js | 142 - application/media/js/jquery.jstree-1.0rc3.js | 4551 +++++++++++++++++ .../js/jquery.jstree.themes/apple/bg.jpg | Bin 0 -> 331 bytes .../media/js/jquery.jstree.themes/apple/d.png | Bin 0 -> 7765 bytes .../apple}/dot_for_ie.gif | Bin .../js/jquery.jstree.themes/apple/style.css | 61 + .../apple}/throbber.gif | Bin .../js/jquery.jstree.themes/classic/d.gif | Bin 0 -> 3003 bytes .../js/jquery.jstree.themes/classic/d.png | Bin 0 -> 7535 bytes .../classic/dot_for_ie.gif | Bin 0 -> 43 bytes .../js/jquery.jstree.themes/classic/style.css | 77 + .../jquery.jstree.themes/classic/throbber.gif | Bin 0 -> 1849 bytes .../js/jquery.jstree.themes/default-rtl/d.gif | Bin 0 -> 2872 bytes .../js/jquery.jstree.themes/default-rtl/d.png | Bin 0 -> 7459 bytes .../jquery.jstree.themes/default-rtl/dots.gif | Bin 0 -> 132 bytes .../default-rtl/style.css | 84 + .../default-rtl/throbber.gif | Bin 0 -> 1849 bytes .../js/jquery.jstree.themes/default/d.gif | Bin 0 -> 2944 bytes .../default/d.png | Bin .../default/style.css | 46 +- .../jquery.jstree.themes/default/throbber.gif | Bin 0 -> 1849 bytes 24 files changed, 4814 insertions(+), 221 deletions(-) delete mode 100644 application/media/css/jquery.jstree.css delete mode 100644 application/media/js/jquery.jstree-1.0rc.js create mode 100644 application/media/js/jquery.jstree-1.0rc3.js create mode 100644 application/media/js/jquery.jstree.themes/apple/bg.jpg create mode 100644 application/media/js/jquery.jstree.themes/apple/d.png rename application/media/js/{themes/default => jquery.jstree.themes/apple}/dot_for_ie.gif (100%) create mode 100644 application/media/js/jquery.jstree.themes/apple/style.css rename application/media/js/{themes/default => jquery.jstree.themes/apple}/throbber.gif (100%) create mode 100644 application/media/js/jquery.jstree.themes/classic/d.gif create mode 100644 application/media/js/jquery.jstree.themes/classic/d.png create mode 100644 application/media/js/jquery.jstree.themes/classic/dot_for_ie.gif create mode 100644 application/media/js/jquery.jstree.themes/classic/style.css create mode 100644 application/media/js/jquery.jstree.themes/classic/throbber.gif create mode 100644 application/media/js/jquery.jstree.themes/default-rtl/d.gif create mode 100644 application/media/js/jquery.jstree.themes/default-rtl/d.png create mode 100644 application/media/js/jquery.jstree.themes/default-rtl/dots.gif create mode 100644 application/media/js/jquery.jstree.themes/default-rtl/style.css create mode 100644 application/media/js/jquery.jstree.themes/default-rtl/throbber.gif create mode 100644 application/media/js/jquery.jstree.themes/default/d.gif rename application/media/js/{themes => jquery.jstree.themes}/default/d.png (100%) rename application/media/js/{themes => jquery.jstree.themes}/default/style.css (51%) create mode 100644 application/media/js/jquery.jstree.themes/default/throbber.gif diff --git a/application/classes/controller/lnapp/templatedefault.php b/application/classes/controller/lnapp/templatedefault.php index 9a253b4d..a5f238f1 100644 --- a/application/classes/controller/lnapp/templatedefault.php +++ b/application/classes/controller/lnapp/templatedefault.php @@ -125,7 +125,7 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template { // This is in a reverse list, since we push them to the beginging of the scripts to render. foreach (array('file'=>array( 'js/jquery.cookie.js', - 'js/jquery.jstree-1.0rc.js', + 'js/jquery.jstree-1.0rc3.js', 'js/jquery-1.4.2.js', )) as $type => $datas) { @@ -215,7 +215,7 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template { * Default Method to call from the tree menu */ public function action_menu() { - $this->template->content = _('Please choose from the menu on the left - you may need to expand the items by pressing on the triangle.'); + $this->template->content = _('Please choose from the menu on the left - you may need to expand the items by pressing on the plus.'); } protected function _headimages() { diff --git a/application/classes/controller/lnapp/tree.php b/application/classes/controller/lnapp/tree.php index fc49ee84..03a490af 100644 --- a/application/classes/controller/lnapp/tree.php +++ b/application/classes/controller/lnapp/tree.php @@ -32,8 +32,7 @@ class Controller_lnApp_Tree extends Controller_Default { $(function () { $("#tree").jstree({ themes : { - "theme" : "default", - "url" : "'.URL::site($mediapath->uri(array('file'=>'css/jquery.jstree.css'))).'", + "theme" : "classic", }, ui : { "select_limit" : 1, @@ -46,7 +45,7 @@ $(function () { "correct_state" : "true", "progressive_render" : "true", "ajax" : { - "url" : "'.URL::site('/tree/json').'", + "url" : "'.URL::site('tree/json').'", "data" : function (n) { return { id : n.attr ? n.attr("id") : "N_"+0 }; } @@ -60,14 +59,15 @@ $(function () { if (a = data.rslt.obj.attr(\'id\').indexOf(\'_\')) { id = data.rslt.obj.attr(\'id\').substr(a+1); - if (href = $("#N_"+id).attr("href")) + if (href = $("#N_"+id).attr("href")) { + $("#ajBODY").empty().html(""); $("#ajBODY").load(href, function(r,s,x) { if (s == "error") { var msg = "Sorry but there was an error: "; $("#ajBODY").html(msg + x.status + " " + x.statusText + r); } }); - else + } else alert("Unknown: "+id+" HREF:"+href); } }); @@ -86,7 +86,7 @@ $(function () { public function action_json(array $data=array()) { if ($this->_auth_required() AND ! Auth::instance()->logged_in()) { $this->output = array('attr'=>array('id'=>'a_login'), - 'data'=>array('title'=>_('Please Login').'...','attr'=>array('id'=>'N_login','href'=>URL::site('/login')))); + 'data'=>array('title'=>_('Please Login').'...','attr'=>array('id'=>'N_login','href'=>URL::site('login')))); return; } @@ -98,7 +98,7 @@ $(function () { 'attr'=>array('id'=>sprintf('B_%s',$branch['id'])), 'state'=>$branch['state'], 'data'=>array('title'=>$branch['name']), - 'attr'=>array('id'=>sprintf('N_%s',$branch['id']),'href'=>empty($branch['attr_href']) ? URL::site(sprintf('/%s/menu',$branch['name'])) : $branch['attr_href']), + 'attr'=>array('id'=>sprintf('N_%s',$branch['id']),'href'=>empty($branch['attr_href']) ? URL::site(sprintf('%s/menu',$branch['name'])) : $branch['attr_href']), ) ); } diff --git a/application/media/css/jquery.jstree.css b/application/media/css/jquery.jstree.css deleted file mode 100644 index 633edee6..00000000 --- a/application/media/css/jquery.jstree.css +++ /dev/null @@ -1,56 +0,0 @@ -/* - * jsTree default theme 1.0 - * Supported features: dots/no-dots, icons/no-icons, focused, loading - * Supported plugins: ui (hovered, clicked), checkbox, contextmenu, search - */ - -.jstree-default li, -.jstree-default ins { background-image:url("../img/jquery.jstree.d.png"); background-repeat:no-repeat; background-color:transparent; } -.jstree-default li { background-position:-90px 0; background-repeat:repeat-y; } -.jstree-default li.jstree-last { background:transparent; } -.jstree-default .jstree-open > ins { background-position:-72px 0; } -.jstree-default .jstree-closed > ins { background-position:-54px 0; } -.jstree-default .jstree-leaf > ins { background-position:-36px 0; } - -.jstree-default .jstree-hovered { background:#FFF0C0; border:1px solid #841212; padding:0 2px 0 1px; color: #841212;} -.jstree-default .jstree-clicked { background:#FCFCFC; border:1px solid #FCFCFC; padding:0 2px 0 1px; color: #841212;} -.jstree-default a .jstree-icon { background-position:-56px -19px; } -.jstree-default a.jstree-loading .jstree-icon { background:url("../img/jquery.jstree.throbber.gif") center center no-repeat !important; } - -.jstree-default.jstree-focused { background:#FCFCFC; } - -.jstree-default .jstree-no-dots li, -.jstree-default .jstree-no-dots .jstree-leaf > ins { background:transparent; } -.jstree-default .jstree-no-dots .jstree-open > ins { background-position:-18px 0; } -.jstree-default .jstree-no-dots .jstree-closed > ins { background-position:0 0; } - -.jstree-default .jstree-no-icons a .jstree-icon { display:none; } - -.jstree-default .jstree-search { font-style:italic; } - -.jstree-default .jstree-no-icons .checkbox { display:inline-block; } -.jstree-default .jstree-no-checkboxes .checkbox { display:none !important; } -.jstree-default .jstree-checked > a > .checkbox { background-position:-38px -19px; } -.jstree-default .jstree-unchecked > a > .checkbox { background-position:-2px -19px; } -.jstree-default .jstree-undetermined > a > .checkbox { background-position:-20px -19px; } -.jstree-default .jstree-checked > a > .checkbox:hover { background-position:-38px -37px; } -.jstree-default .jstree-unchecked > a > .checkbox:hover { background-position:-2px -37px; } -.jstree-default .jstree-undetermined > a > .checkbox:hover { background-position:-20px -37px; } - -#vakata-dragged.jstree-default ins { background:transparent !important; } -#vakata-dragged.jstree-default .jstree-ok { background:url("../img/jquery.jstree.d.png") -2px -53px no-repeat !important; } -#vakata-dragged.jstree-default .jstree-invalid { background:url("../img/jquery.jstree.d.png") -18px -53px no-repeat !important; } -#jstree-marker.jstree-default { background:url("../img/jquery.jstree.d.png") -41px -57px no-repeat !important; } - -.jstree-default a.jstree-search { color:aqua; } - -#vakata-contextmenu.jstree-default-context, -#vakata-contextmenu.jstree-default-context li ul { background:#f0f0f0; border:1px solid #979797; -moz-box-shadow: 1px 1px 2px #999; -webkit-box-shadow: 1px 1px 2px #999; box-shadow: 1px 1px 2px #999; } -#vakata-contextmenu.jstree-default-context li { } -#vakata-contextmenu.jstree-default-context a { color:black; } -#vakata-contextmenu.jstree-default-context a:hover, -#vakata-contextmenu.jstree-default-context .vakata-hover > a { padding:0 5px; background:#e8eff7; border:1px solid #aecff7; color:black; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; } -#vakata-contextmenu.jstree-default-context li.vakata-separator { background:white; border-top:1px solid #e0e0e0; margin:0; } -#vakata-contextmenu.jstree-default-context li ul { margin-left:-4px; } - -/* TODO: IE6 support - the `>` selectors */ diff --git a/application/media/js/jquery.jstree-1.0rc.js b/application/media/js/jquery.jstree-1.0rc.js deleted file mode 100644 index f3debe39..00000000 --- a/application/media/js/jquery.jstree-1.0rc.js +++ /dev/null @@ -1,142 +0,0 @@ -(function(c){c.vakata={};c.vakata.css={get_css:function(a,d,g){a=a.toLowerCase();var f=g.cssRules||g.rules,b=0;do{if(f.length&&b>f.length+5)return false;if(f[b].selectorText&&f[b].selectorText.toLowerCase()==a)if(d===true){g.removeRule&&g.removeRule(b);g.deleteRule&&g.deleteRule(b);return true}else return f[b]}while(f[++b]);return false},add_css:function(a,d){if(c.jstree.css.get_css(a,false,d))return false;d.insertRule?d.insertRule(a+" { }",0):d.addRule(a,null,0);return c.vakata.css.get_css(a)},remove_css:function(a, -d){return c.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(g){}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(c){var a=[],d=-1,g={},f={};c.fn.jstree=function(b){var e=typeof b=="string",h=Array.prototype.slice.call(arguments,1),k=this;!e&&c.meta&&h.push(c.metadata.get(this).jstree);b=!e&&h.length?c.extend.apply(null,[true,b].concat(h)):b;if(e&&b.substring(0,1)=="_")return k;e?this.each(function(){var j=a[c.data(this,"jstree-instance-id")];j=j&&c.isFunction(j[b])?j[b].apply(j,h):j;if(typeof j!=="undefined"&&j!==true&&j!==false){k=j;return false}}):this.each(function(){var j=c.data(this,"jstree-instance-id"), -i=false;j&&a[j]&&a[j].destroy();j=parseInt(a.push({}),10)-1;c.data(this,"jstree-instance-id",j);b.plugins=c.isArray(b.plugins)?b.plugins:c.jstree.defaults.plugins;c.inArray("core",b.plugins)===-1&&b.plugins.unshift("core");i=c.extend(true,{},c.jstree.defaults,b);i.plugins=b.plugins;a[j]=new c.jstree._instance(j,c(this).addClass("jstree jstree-"+j),i);c.each(a[j].get_settings().plugins,function(m,l){a[j].data[l]={}});c.each(a[j].get_settings().plugins,function(m,l){g[l]&&g[l].__init.apply(a[j])}); -a[j].init()});return k};c.jstree={defaults:{plugins:[]},_focused:function(){return a[d]||null},_reference:function(b){if(a[b])return a[b];var e=c(b);if(!e.length&&typeof b==="string")e=c("#"+b);if(!e.length)return null;return a[e.closest(".jstree").data("jstree-instance-id")]||null},_instance:function(b,e,h){this.data={core:{}};this.get_settings=function(){return c.extend(true,{},h)};this.get_index=function(){return b};this.get_container=function(){return e};this._set_settings=function(k){h=c.extend(true, -{},h,k)}},_fn:{},plugin:function(b,e){e=c.extend({},{__init:c.noop,__destroy:c.noop,_fn:{},defaults:false},e);g[b]=e;c.jstree.defaults[b]=e.defaults;c.each(e._fn,function(h,k){k.plugin=b;k.old=c.jstree._fn[h];c.jstree._fn[h]=function(){var j,i=k,m=Array.prototype.slice.call(arguments);j=this.get_settings();var l=new c.Event("before.jstree"),o=false;do{if(i&&i.plugin&&c.inArray(i.plugin,j.plugins)!==-1)break;i=i.old}while(i);if(i){j=this.get_container().triggerHandler(l,{func:h,inst:this,args:m}); -if(j!==false){if(typeof j!=="undefined")m=j;return j=i.apply(c.extend({},this,{__callback:function(n){this.get_container().triggerHandler(h+".jstree",{inst:this,args:m,rslt:n,rlbk:o})},__rollback:function(){return o=this.get_rollback()},__call_old:function(n){return i.old.apply(this,n?Array.prototype.slice.call(arguments,1):m)}}),m)}}};c.jstree._fn[h].old=k.old;c.jstree._fn[h].plugin=b})},rollback:function(b){if(b){c.isArray(b)||(b=[b]);c.each(b,function(e,h){a[h.i].set_rollback(h.h,h.d)})}}};c.jstree._fn= -c.jstree._instance.prototype={};c(function(){var b=navigator.userAgent.toLowerCase(),e=(b.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 > ul > li { margin-left: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; } li.jstree-open > ul { display:block; } li.jstree-closed > ul { display:none; } "; -if(/msie/.test(b)&&parseInt(e,10)==6)h+=".jstree li { height:18px; margin-left:0; } .jstree li li { margin-left:18px; } li.jstree-open ul { display:block; } li.jstree-closed ul { display:none !important; } .jstree li a { display:inline; } .jstree li a ins { height:16px; width:16px; margin-right:3px; } ";c.vakata.css.add_sheet({str:h})});c.jstree.plugin("core",{__init:function(){this.data.core.to_open=c.map(c.makeArray(this.get_settings().core.initially_open),function(b){return"#"+b.toString().replace(/^#/, -"").replace("\\/","/").replace("/","\\/")})},defaults:{html_titles:false,animation:500,initially_open:[]},_fn:{init:function(){this.set_focus();this.get_container().html("");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",c.proxy(function(b){var e= -c(b.target);e.is("ins")&&b.pageY-e.offset().top ul > li:first-child");if(!b.length)return false;if(e)return b.nextAll("li").size()>0?b.nextAll("li:eq(0)"):false;return b.hasClass("jstree-open")?b.find("li:eq(0)"):b.nextAll("li").size()> -0?b.nextAll("li:eq(0)"):b.parentsUntil(this.get_container(),"li").next("li").eq(0)},_get_prev:function(b,e){b=this._get_node(b);if(b===-1)return this.get_container().find("> ul > li:last-child");if(!b.length)return false;if(e)return b.prevAll("li").length>0?b.prevAll("li:eq(0)"):false;if(b.prev("li").length){for(b=b.prev("li").eq(0);b.hasClass("jstree-open");)b=b.children("ul:eq(0)").children("li:last");return b}else{var h=b.parentsUntil(this.get_container(),"li:eq(0)");return h.length?h:false}}, -_get_parent:function(b){b=this._get_node(b);if(b==-1||!b.length)return false;b=b.parentsUntil(this.get_container(),"li:eq(0)");return b.length?b:-1},_get_children:function(b){b=this._get_node(b);if(b===-1)return this.get_container().children("ul:eq(0)").children("li");if(!b.length)return false;return b.children("ul:eq(0)").children("li")},get_path:function(b,e){var h=[],k=this;b=this._get_node(b);if(b===-1||!b||!b.length)return false;b.parentsUntil(this.get_container(),"li").each(function(){h.push(e? -this.id:k.get_text(this))});h.reverse();h.push(e?b.attr("id"):this.get_text(b));return h},open_node:function(b,e,h){b=this._get_node(b);if(!b.length)return false;var k=h?0:this.get_settings().core.animation,j=this;if(this._is_loaded(b)){k&&b.children("ul").css("display","none");b.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading");k&&b.children("ul").slideDown(k,function(){this.style.display=""});this.__callback({obj:b});e&&e.call()}else{b.children("a").addClass("jstree-loading"); -this.load_node(b,function(){j.open_node(b,e,h)},e)}},close_node:function(b,e){b=this._get_node(b);var h=e?0:this.get_settings().core.animation;if(!b.length)return false;h&&b.children("ul").attr("style","display:block !important");b.removeClass("jstree-open").addClass("jstree-closed");h&&b.children("ul").slideUp(h,function(){this.style.display=""});this.__callback({obj:b})},toggle_node:function(b){b=this._get_node(b);if(b.hasClass("jstree-closed"))return this.open_node(b);if(b.hasClass("jstree-open"))return this.close_node(b)}, -open_all:function(b,e){b=b?this._get_node(b):this.get_container();if(e)b=b.find("li.jstree-closed");else{e=b;b=b.is(".jstree-closed")?b.find("li.jstree-closed").andSelf():b.find("li.jstree-closed")}var h=this;b.each(function(){var k=this;h._is_loaded(this)?h.open_node(this,false,true):h.open_node(this,function(){h.open_all(k,e)},true)});e.find("li.jstree-closed").length===0&&this.__callback({obj:e})},close_all:function(b){var e=this;b=b?this._get_node(b):this.get_container();b.find("li.jstree-open").andSelf().each(function(){e.close_node(this)}); -this.__callback({obj:b})},clean_node:function(b){b=b&&b!=-1?c(b):this.get_container();b=b.is("li")?b.find("li").andSelf():b.find("li");b.removeClass("jstree-last").filter("li:last-child").addClass("jstree-last").end().filter(":has(ul)").not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed");b.not(".jstree-open, .jstree-closed").addClass("jstree-leaf");this.__callback({obj:b})},get_rollback:function(){this.__callback();return{i:this.get_index(),h:this.get_container().children("ul").clone(true), -d:this.data}},set_rollback:function(b,e){this.get_container().empty().append(b);this.data=e;this.__callback()},load_node:function(b){this.__callback({obj:b})},_is_loaded:function(){return true},create_node:function(b,e,h,k,j){b=this._get_node(b);e=typeof e==="undefined"?"last":e;var i=c("
  • "),m=this.get_settings().core.html_titles,l;if(b!==-1&&!b.length)return false;if(!j&&!this._is_loaded(b)){this.load_node(b,function(){this.create_node(b,e,h,k,true)});return false}this.__rollback();if(typeof h=== -"string")h={data:h};h||(h={});h.attr&&i.attr(h.attr);h.state&&i.addClass("jstree-"+h.state);if(!h.data)h.data="New node";if(!c.isArray(h.data)){l=h.data;h.data=[];h.data.push(l)}c.each(h.data,function(o,n){l=c("");if(c.isFunction(n))n=n.call(this,h);if(typeof n=="string")l.attr("href","#")[m?"html":"text"](n);else{if(!n.attr)n.attr={};if(!n.attr.href)n.attr.href="#";l.attr(n.attr)[m?"html":"text"](n.title);n.language&&l.addClass(n.language)}l.prepend(" ");if(n.icon)n.icon.indexOf("/")=== --1?l.children("ins").addClass(n.icon):l.children("ins").css("background","url('"+n.icon+"') center center no-repeat;");i.append(l)});i.prepend(" ");if(b===-1){b=this.get_container();if(e==="before")e="first";if(e==="after")e="last"}switch(e){case "before":b.before(i);l=this._get_parent(b);break;case "after":b.after(i);l=this._get_parent(b);break;case "inside":case "first":b.children("ul").length||b.append("