Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

YUI.add("moodle-course-categoryexpander",function(s,e){var a="collapse-all",p="disabled",i="loaded",g="notloaded",t="collapsed",_="with_children",h=".with_children",u=".with_children.loaded",l=".content",n=".category .info .categoryname",x=".categoryname",f=".category.with_children.collapsed",y=".category.with_children.loaded.collapsed",r=".category.with_children.loaded:not(.collapsed)",c=".collapseexpand",m=".coursebox",o=".coursebox .moreinfo",v=".info .moreinfo",b=".course_category_tree",C=".category",d=s.namespace("Moodle.course.categoryexpander"),w=M.cfg.wwwroot+"/course/category.ajax.php";d.init=function(){var e=s.one(s.config.doc);e.delegate("click",this.toggle_category_expansion,n,this),e.delegate("click",this.toggle_coursebox_expansion,o,this),e.delegate("click",this.collapse_expand_all,c,this),e.once("key",this.setup_keyboard_listeners,"tab",this)},d.setup_keyboard_listeners=function(){s.one(s.config.doc).all(n,o,c).setAttribute("tabindex","0"),s.one(s.config.doc).delegate("key",this.toggle_category_expansion,"enter",n,this),s.one(s.config.doc).delegate("key",this.toggle_coursebox_expansion,"enter",o,this),s.one(s.config.doc).delegate("key",this.collapse_expand_all,"enter",c,this)},d.expand_category=function(e){s.use("io-base","json-parse","moodle-core-notification","anim-node-plugin",function(){d.expand_category=d._expand_category,d.expand_category(e)})},d._expand_category=function(e){var n,o;e.hasClass(_)&&(e.hasClass(i)?this.run_expansion(e):(n=e.getData("categoryid"),o=e.getData("depth"),void 0!==n&&void 0!==o&&this._toggle_generic_expansion({parentnode:e,childnode:e.one(l),spinnerhandle:x,data:{categoryid:n,depth:o,showcourses:e.getData("showcourses"),type:0}})))},d.toggle_category_expansion=function(e){s.use("io-base","json-parse","moodle-core-notification","anim-node-plugin",function(){d.toggle_category_expansion=d._toggle_category_expansion,d.toggle_category_expansion(e)})},d.toggle_coursebox_expansion=function(e){s.use("io-base","json-parse","moodle-core-notification","anim-node-plugin",function(){d.toggle_coursebox_expansion=d._toggle_coursebox_expansion,d.toggle_coursebox_expansion(e)}),e.preventDefault()},d._toggle_coursebox_expansion=function(e){var n=e.target.ancestor(m,!0);e.preventDefault(),n.hasClass(i)?this.run_expansion(n):this._toggle_generic_expansion({parentnode:n,childnode:n.one(l),spinnerhandle:v,data:{courseid:n.getData("courseid"),type:1}})},d._toggle_category_expansion=function(e){var n,o;e.target.test("a")||e.target.test("img")||(e=e.target.ancestor(C,!0)).hasClass(_)&&(e.hasClass(i)?this.run_expansion(e):(n=e.getData("categoryid"),o=e.getData("depth"),void 0!==n&&void 0!==o&&this._toggle_generic_expansion({parentnode:e,childnode:e.one(l),spinnerhandle:x,data:{categoryid:n,depth:o,showcourses:e.getData("showcourses"),type:0}})))},d._toggle_generic_expansion=function(e){var n;e.spinnerhandle&&(n=M.util.add_spinner(s,e.parentnode.one(e.spinnerhandle)).show()),s.io(w,{method:"POST",context:this,on:{complete:this.process_results},data:e.data,arguments:{parentnode:e.parentnode,childnode:e.childnode,spinner:n}})},d.run_expansion=function(e){var n=e.one(l),o=this,a=e.ancestor(b);this.add_animation(n),e.hasClass(t)?(n.setStyle("height","0"),e.removeClass(t),e.setAttribute("aria-expanded","true"),n.fx.set("reverse",!1)):(n.fx.set("reverse",!0),n.fx.once("end",function(e,n){n.addClass(t),n.setAttribute("aria-expanded","false")},this,e)),n.fx.once("end",function(e,n){n.setStyles({height:"",opacity:""}),this.destroy(),o.update_collapsible_actions(a)},n.fx,n),n.fx.run()},d.collapse_expand_all=function(e){s.use("io-base","json-parse","moodle-core-notification","anim-node-plugin",function(){d.collapse_expand_all=d._collapse_expand_all,d.collapse_expand_all(e)}),e.preventDefault()},d._collapse_expand_all=function(e){e.preventDefault(),e.currentTarget.hasClass(p)||(e=e.currentTarget.ancestor(b))&&(e.one(c).hasClass(a)?this.collapse_all(e):this.expand_all(e),this.update_collapsible_actions(e))},d.expand_all=function(e){var n=[];e.all(f).each(function(e){e.ancestor(f)?(e.removeClass(t),e.all(h).removeClass(t)):n.push(e)},this),s.all(n).each(function(e){this.expand_category(e)},this)},d.collapse_all=function(e){var n=[];e.all(r).each(function(e){e.ancestor(r)?n.push(e):this.run_expansion(e)},this),s.all(n).each(function(e){e.addClass(t),e.all(u).addClass(t)},this)},d.update_collapsible_actions=function(e){var n=!1,o=e.one(c);o&&(e.all(r).each(function(e){return!e.ancestor(y)&&(n=!0)}),(n?o.setHTML(M.util.get_string("collapseall","moodle")).addClass(a):o.setHTML(M.util.get_string("expandall","moodle")).removeClass(a)).removeClass(p))},d.process_results=function(e,n,o){var a;try{if((a=s.JSON.parse(n.responseText)).error)return new M.core.ajaxException(a)}catch(t){return new M.core.exception(t)}n=s.Node.create(a),o.childnode.appendChild(n),o.parentnode.addClass(i).removeClass(g),this.run_expansion(o.parentnode),o.spinner&&o.spinner.hide().destroy()},d.add_animation=function(e){return"undefined"!=typeof e.fx||e.plug(s.Plugin.NodeFX,{from:{height:0,opacity:0},to:{height:function(e){return e.get("scrollHeight")},opacity:1},duration:.2}),e}},"@VERSION@",{requires:["node","event-key"]});