YUI.add("moodle-backup-backupselectall",function(e,t){M.core_backup=M.core_backup||{},M.core_backup.backupselectall=function(t){var n=null,r=function(t,r,i,s){t.preventDefault();var o="";typeof s!="undefined"&&(o="setting_activity_"+s+"_");var u=i.length;e.all('input[type="checkbox"]').each(function(e){var t=e.get("name");if(o&&t.substring(0,o.length)!==o)return;t.substring(t.length-u)===i&&e.set("checked",r)}),n&&M.form&&M.form.updateFormState(n)},i=function(e,t,n,r){return typeof r=="undefined"&&(r=""),'<div class="'+e+'">'+'<div class="fitem fitem_fcheckbox backup_selector">'+'<div class="fitemtitle">'+n+"</div>"+'<div class="felement">'+'<a id="backup-all-'+t+'" href="#">'+M.util.get_string("all","moodle")+"</a> / "+'<a id="backup-none-'+t+'" href="#">'+M.util.get_string("none","moodle")+"</a>"+r+"</div>"+"</div>"+"</div>"},s=e.one("fieldset#id_coursesettings .fcontainer.clearfix .grouped_settings.section_level");if(!s)return;if(!s.one('input[type="checkbox"]'))return;n=s.ancestor("form").getAttribute("id");var o=!1;e.all('input[type="checkbox"]').each(function(e){var t=e.get("name");t.substring(t.length-9)==="_userdata"?o="_userdata":t.substring(t.length-9)==="_userinfo"&&(o="_userinfo")});var u=i("include_setting section_level","included",M.util.get_string("select","moodle"),' (<a id="backup-bytype" href="#">'+M.util.get_string("showtypes","backup")+"</a>)");o&&(u+=i("normal_setting","userdata",M.util.get_string("select","moodle")));var a=e.Node.create('<div class="grouped_settings section_level">'+u+"</div>");s.insert(a,"before");var f=function(t,n){e.one("#backup-all-mod_"+n).on("click",function(e){r(e,!0,"_included",n)}),e.one("#backup-none-mod_"+n).on("click",function(e){r(e,!1,"_included",n)}),o&&(e.one("#backup-all-userdata-mod_"+n).on("click",function(e){r(e,!0,o,n)}),e.one("#backup-none-userdata-mod_"+n).on("click",function(e){r(e,!1,o,n)}))},l=e.Node.create('<div id="mod_select_links">');l.hide(),l.currentlyshown=!1,a.appendChild(l);for(var c in t){if(!t.hasOwnProperty(c))continue;u=i("include_setting section_level","mod_"+c,t[c]),o&&(u+=i("normal_setting","userdata-mod_"+c,t[c]));var h=e.Node.create('<div class="grouped_settings section_level">'+u+"</div>");l.appendChild(h),f(h,c)}var p=function(){var t=e.one("#backup-bytype");l.currentlyshown?t.setHTML(M.util.get_string("showtypes","backup")):t.setHTML(M.util.get_string("hidetypes","backup")),l.currentlyshown=!l.currentlyshown;var n={node:l,duration:.2},r;l.currentlyshown?(l.show(),n.to={maxHeight:l.get("clientHeight")+"px"},l.setStyle("maxHeight","0px"),r=new e.Anim(n),r.on("end",function(){l.setStyle("maxHeight","none")}),r.run()):(n.to={maxHeight:"0px"},l.setStyle("maxHeight",l.get("clientHeight")+"px"),r=new e.Anim(n),r.on("end",function(){l.hide(),l.setStyle("maxHeight","none")}),r.run())};e.one("#backup-bytype").on("click",function(e){e.preventDefault(),p()}),e.one("#backup-all-included").on("click",function(e){r(e,!0,"_included")}),e.one("#backup-none-included").on("click",function(e){r(e,!1,"_included")}),o&&(e.one("#backup-all-userdata").on("click",function(e){r(e,!0,o)}),e.one("#backup-none-userdata").on("click",function(e){r(e,!1,o)}))}},"@VERSION@",{requires:["node","event","node-event-simulate","anim"]});
