diff --git a/htdocs/js/apps/LocalStorage/localstorage.js b/htdocs/js/apps/LocalStorage/localstorage.js index 7b11953eda..d000daf713 100644 --- a/htdocs/js/apps/LocalStorage/localstorage.js +++ b/htdocs/js/apps/LocalStorage/localstorage.js @@ -19,26 +19,25 @@ var WWLocalStorage = function(givenContainer) { storedData = {}; } - var storeData = function () { - //event.preventDefault(); - - if (!storedData['inputs']) { - storedData['inputs'] = {}; - } - - var inputs = $(container).find(":input") - .each(function(index,input) { - if ($(input).attr('type').toUpperCase() == 'RADIO') { - var name = $(input).attr('name'); - storedData['inputs'][name] = $('input[name="'+name+'"]:checked').val(); - } else if (/AnSwEr/.test($(input).attr('name'))) { - - storedData['inputs'][$(input).attr('name')] = $(input).val(); + var storeData = function () { + if (!storedData['inputs']) { + storedData['inputs'] = {}; } - }); - $.jStorage.set(identifier,storedData); - } + var inputs = $(container).find(":input") + .each(function(index) { + var input = $(this); + var type = input.attr('type'); + if (type && type.toUpperCase() == 'RADIO') { + var name = input.attr('name'); + storedData['inputs'][name] = $('input[name="'+name+'"]:checked').val(); + } else if (/AnSwEr/.test(input.attr('name'))) { + storedData['inputs'][input.attr('name')] = $(input).val(); + } + }); + + $.jStorage.set(identifier,storedData); + } $(container).find(":submit").click(storeData); diff --git a/htdocs/js/apps/ProblemSetDetail2/problemsetdetail2.js b/htdocs/js/apps/ProblemSetDetail2/problemsetdetail2.js index a20c556f7d..d9584761a8 100644 --- a/htdocs/js/apps/ProblemSetDetail2/problemsetdetail2.js +++ b/htdocs/js/apps/ProblemSetDetail2/problemsetdetail2.js @@ -241,7 +241,7 @@ ro.permissionLevel = 10; ro.noprepostambles = 1; ro.processAnswers = 0; - ro.showFooter = "no"; + ro.showFooter = 0; ro.displayMode = $('#problem_displaymode').val(); ro.extra_header_text = ""; if (window.location.port) ro.forcePortNumber = window.location.port; diff --git a/htdocs/js/apps/SetMaker/setmaker.js b/htdocs/js/apps/SetMaker/setmaker.js index cdd48b6916..f2783be218 100644 --- a/htdocs/js/apps/SetMaker/setmaker.js +++ b/htdocs/js/apps/SetMaker/setmaker.js @@ -367,7 +367,7 @@ ro.showSolutions = $('input[name=showSolutions]').is(':checked') ? 1 : 0; ro.noprepostambles = 1; ro.processAnswers = 0; - ro.showFooter = "no"; + ro.showFooter = 0; ro.displayMode = $('select[name=mydisplayMode]').val(); ro.send_pg_flags = 1; ro.extra_header_text = ""; diff --git a/lib/FormatRenderedProblem.pm b/lib/FormatRenderedProblem.pm index 8b133818d8..72f75d4953 100644 --- a/lib/FormatRenderedProblem.pm +++ b/lib/FormatRenderedProblem.pm @@ -125,6 +125,10 @@ sub formatRenderedProblem { my $fileName = $self->{input}{envir}{fileName} // ""; my $encoded_source = $self->encoded_source // ""; + # Select the theme and theme directory + my $theme = $self->{inputs_ref}{theme} || $ce->{defaultTheme}; + my $themeDir = "$ce->{webworkURLs}{htdocs}/themes/$theme"; + # Set up the header text my $problemHeadText = ''; @@ -212,7 +216,7 @@ sub formatRenderedProblem { summary => $problemResult->{summary} // '', # can be set by problem grader ); my $answerTemplate = $tbl->answerTemplate; - my $color_input_blanks_script = $tbl->color_answer_blanks; + my $color_input_blanks_script = (!$previewMode && ($checkMode || $submitMode)) ? $tbl->color_answer_blanks : ""; $tbl->imgGen->render(refresh => 1) if $tbl->displayMode eq 'images'; # Score summary @@ -236,16 +240,29 @@ sub formatRenderedProblem { $localStorageMessages .= CGI::p('Your overall score for this problem is ' . CGI::span({ id => 'problem-overall-score' }, '')); $localStorageMessages .= CGI::end_div(); - # Submit buttons - my $STRING_Preview = $mt->maketext("Preview My Answers"); - my $STRING_ShowCorrect = $mt->maketext("Show correct answers"); - my $STRING_Submit = $mt->maketext("Check Answers"); + # Submit buttons (all are shown by default) + my $showPreviewButton = $self->{inputs_ref}{showPreviewButton} // ""; + my $previewButton = $showPreviewButton eq "0" ? '' : + ''; + my $showCheckAnswersButton = $self->{inputs_ref}{showCheckAnswersButton} // ""; + my $checkAnswersButton = $showCheckAnswersButton eq "0" ? '' : + ''; + my $showCorrectAnswersButton = $self->{inputs_ref}{showCorrectAnswersButton} // ""; + my $correctAnswersButton = $showCorrectAnswersButton eq "0" ? '' : + ''; + + my $showSolutions = $self->{inputs_ref}{showSolutions} // ""; + my $showHints = $self->{inputs_ref}{showHints} // ""; # Regular Perl warning messages generated with warn. my $warnings = ''; - if (defined($rh_result->{WARNINGS}) and $rh_result->{WARNINGS}) { - $warnings = qq{
WARNINGS
} . - decode_utf8_base64($rh_result->{WARNINGS}) . "
TRANSLATOR WARNINGS
} . + decode_utf8_base64($rh_result->{translator_warnings}) . "
- - - -
-- - - +$previewButton +$checkAnswersButton +$correctAnswersButton