Commit 37e5cdf6 authored by Nigel McNie's avatar Nigel McNie
Browse files

Disallow running the exporter with nothing selected.

parent e4ef6504
......@@ -97,6 +97,22 @@ $form = pieform(array(
));
function export_validate(Pieform $form, $values) {
global $SESSION;
if ($values['what'] == 'views') {
$viewchosen = false;
foreach ($values as $key => $value) {
if (substr($key, 0, 5) == 'view_' && $value) {
$viewchosen = true;
}
}
if (!$viewchosen) {
$form->set_error('what', '');
$SESSION->add_error_msg(get_string('youmustselectatleastoneviewtoexport', 'export'));
}
}
}
function export_submit(Pieform $form, $values) {
global $SESSION;
$views = array();
......
......@@ -35,6 +35,11 @@ addLoadEvent(function() {
slideUp(container, {'duration': 0.5, 'afterFinish': enableRadios});
}
});
// Open the view selector if the views checkbox is select on page load
if (radio.value == 'views' && radio.checked && !containerVisible) {
containerVisible = true;
removeElementClass(container, 'js-hidden');
}
});
// Hook up 'click to preview' links
......
......@@ -43,6 +43,7 @@ $string['unabletogenerateexport'] = 'Unable to generate export';
$string['viewstoexport'] = 'Views to export';
$string['whatdoyouwanttoexport'] = 'What do you want to export?';
$string['youarehere'] = 'You are here';
$string['youmustselectatleastoneviewtoexport'] = 'You must select at least one View to export';
$string['zipnotinstalled'] = 'Your system does not have the zip command. Please install zip to enable this feature';
?>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment