');
modlist.hide();
modlist.currentlyshown = false;
links.appendChild(modlist);
for (var mod in modnames) {
// Only include actual values from the list.
if (!modnames.hasOwnProperty(mod)) {
continue;
}
html = html_generator('include_setting section_level', 'mod_' + mod, modnames[mod]);
if (withuserdata) {
html += html_generator('normal_setting', 'userdata-mod_' + mod, modnames[mod]);
}
var modlinks = Y.Node.create(
'
' + html + '
');
modlist.appendChild(modlinks);
initlinks(modlinks, mod);
}
// Toggles the display of the hidden module select all/none links.
var toggletypes = function() {
// Change text of type toggle link.
var link = Y.one('#backup-bytype');
if (modlist.currentlyshown) {
link.setHTML(M.util.get_string('showtypes', 'backup'));
} else {
link.setHTML(M.util.get_string('hidetypes', 'backup'));
}
// The link has now been toggled (from show to hide, or vice-versa).
modlist.currentlyshown = !modlist.currentlyshown;
// Either hide or show the links.
var animcfg = {node: modlist, duration: 0.2},
anim;
if (modlist.currentlyshown) {
// Animate reveal of the module links.
modlist.show();
animcfg.to = {maxHeight: modlist.get('clientHeight') + 'px'};
modlist.setStyle('maxHeight', '0px');
anim = new Y.Anim(animcfg);
anim.on('end', function() {
modlist.setStyle('maxHeight', 'none');
});
anim.run();
} else {
// Animate hide of the module links.
animcfg.to = {maxHeight: '0px'};
modlist.setStyle('maxHeight', modlist.get('clientHeight') + 'px');
anim = new Y.Anim(animcfg);
anim.on('end', function() {
modlist.hide();
modlist.setStyle('maxHeight', 'none');
});
anim.run();
}
};
Y.one('#backup-bytype').on('click', function(e) {
e.preventDefault();
toggletypes();
});
Y.one('#backup-all-included').on('click', function(e) {
helper(e, true, '_included');
});
Y.one('#backup-none-included').on('click', function(e) {
helper(e, false, '_included');
});
if (withuserdata) {
Y.one('#backup-all-userdata').on('click', function(e) {
helper(e, true, withuserdata);
});
Y.one('#backup-none-userdata').on('click', function(e) {
helper(e, false, withuserdata);
});
}
};