Commit fc904a91 authored by Nigel McNie's avatar Nigel McNie
Browse files

When a file is selected to attach to view feedback, disable and uncheck the...

When a file is selected to attach to view feedback, disable and uncheck the 'make public' checkbox. Fixes #1938.
parent 30e9882c
...@@ -59,7 +59,7 @@ if ($submittedgroup && (user_can_access_group($submittedgroup) & GROUP_MEMBERSHI ...@@ -59,7 +59,7 @@ if ($submittedgroup && (user_can_access_group($submittedgroup) & GROUP_MEMBERSHI
// been submitted to, and is entitled to upload an additional // been submitted to, and is entitled to upload an additional
// file when submitting feedback. // file when submitting feedback.
$tutorfilefeedbackformrow = "TR(null, TH(null, LABEL(null, '" . get_string('attachfile', 'view') . "')))," $tutorfilefeedbackformrow = "TR(null, TH(null, LABEL(null, '" . get_string('attachfile', 'view') . "'))),"
. "TR(null, TD(null, INPUT({'type':'file', 'name':'attachment'}))),"; . "TR(null, TD(null, INPUT({'type':'file', 'name':'attachment', 'onchange': 'process_public_checkbox(this)'}))),";
} }
$viewbeingwatched = (int)record_exists('usr_watchlist_view', 'usr', $USER->get('id'), 'view', $viewid); $viewbeingwatched = (int)record_exists('usr_watchlist_view', 'usr', $USER->get('id'), 'view', $viewid);
...@@ -83,7 +83,7 @@ if (!empty($feedbackisprivate)) { ...@@ -83,7 +83,7 @@ if (!empty($feedbackisprivate)) {
} }
else { else {
$makepublic = "TR(null, TH(null, LABEL(null, " . $getstring['makepublic'] . " ), " $makepublic = "TR(null, TH(null, LABEL(null, " . $getstring['makepublic'] . " ), "
. "INPUT({'type':'checkbox', 'class':'checkbox', 'name':'ispublic'}))),"; . "INPUT({'type':'checkbox', 'class':'checkbox', 'name':'ispublic', 'id': 'ispublic'}))),";
} }
$javascript = <<<EOF $javascript = <<<EOF
...@@ -249,6 +249,19 @@ feedbacklist.emptycontent = {$getstring['nopublicfeedback']}; ...@@ -249,6 +249,19 @@ feedbacklist.emptycontent = {$getstring['nopublicfeedback']};
feedbacklist.updateOnLoad(); feedbacklist.updateOnLoad();
function process_public_checkbox(input) {
var checkbox = $('ispublic');
if (input.value != '') {
log('making public checkbox not checked and disabled');
checkbox.checked = false;
checkbox.disabled = 'disabled';
}
else {
log('making public checkbox enabled');
checkbox.disabled = '';
}
}
EOF; EOF;
$smarty = smarty( $smarty = smarty(
......
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