From 7daaa04324d9d3bc1b311cf9eafc3e6e5f1a7da9 Mon Sep 17 00:00:00 2001 From: drdrew42 Date: Tue, 13 Jun 2023 20:47:17 -0500 Subject: [PATCH] Dockerfile and documentation update --- Dockerfile | 2 +- conf/pg_config.yml | 4 +--- lib/WeBWorK/FormatRenderedProblem.pm | 11 +++++------ lib/WeBWorK/RenderProblem.pm | 6 +++--- package-lock.json | 6 ++++++ 5 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 package-lock.json diff --git a/Dockerfile b/Dockerfile index ae6221b36..011fc4114 100644 --- a/Dockerfile +++ b/Dockerfile @@ -55,7 +55,7 @@ RUN cp render_app.conf.dist render_app.conf RUN cp conf/pg_config.yml lib/PG/conf/pg_config.yml -RUN npm install +RUN cd public/ && npm install && cd .. RUN cd lib/PG/htdocs && npm install && cd ../../.. diff --git a/conf/pg_config.yml b/conf/pg_config.yml index e1863774d..950ac9570 100644 --- a/conf/pg_config.yml +++ b/conf/pg_config.yml @@ -40,6 +40,7 @@ directories: # (in this order) by loadMacros when it looks for a .pl macro file. macrosPath: - . + - $render_root/private/macros - $pg_root/macros - $pg_root/macros/answers - $pg_root/macros/capa @@ -182,9 +183,6 @@ options: # This is the operations file to use for mathview, each contains a different locale. mathViewLocale: mv_locale_us.js - # Set to 1 to show the WirisEditor preview system. - useWirisEditor: 0 - # Catch translation warnings internally. catchWarnings: 1 diff --git a/lib/WeBWorK/FormatRenderedProblem.pm b/lib/WeBWorK/FormatRenderedProblem.pm index 7004ed69a..38affd875 100644 --- a/lib/WeBWorK/FormatRenderedProblem.pm +++ b/lib/WeBWorK/FormatRenderedProblem.pm @@ -49,8 +49,8 @@ sub formatRenderedProblem { $renderErrorOccurred = 1; } - my $SITE_URL = $ENV{baseURL}; - my $FORM_ACTION_URL = $ENV{formURL}; + my $SITE_URL = $inputs_ref->{baseURL}; + my $FORM_ACTION_URL = $inputs_ref->{formURL}; my $displayMode = $inputs_ref->{displayMode} // 'MathJax'; @@ -106,8 +106,7 @@ sub formatRenderedProblem { # Get the requested format. (outputFormat or outputformat) # override to static mode if showCorrectAnswers has been set my $formatName = $inputs_ref->{showCorrectAnswers} && !$inputs_ref->{isInstructor} - ? 'static' - : $inputs_ref->{outputFormat} // $inputs_ref->{outputformat} // 'default'; + ? 'static' : $inputs_ref->{outputFormat}; # Add JS files requested by problems via ADD_JS_FILE() in the PG file. my @extra_js_files; @@ -248,8 +247,8 @@ sub formatRenderedProblem { answerTemplate => $answerTemplate, showScoreSummary => $submitMode && !$renderErrorOccurred && !$previewMode && $problemResult, answerhashXML => $answerhashXML, - showPreviewButton => $inputs_ref->{showPreviewButton} // '', - showCheckAnswersButton => $inputs_ref->{showCheckAnswersButton} // '', + showPreviewButton => $inputs_ref->{hidePreviewButton} ? '' : 0, + showCheckAnswersButton => $inputs_ref->{hideCheckAnswersButton} ? '' : 0, showCorrectAnswersButton => $inputs_ref->{showCorrectAnswersButton} // $inputs_ref->{isInstructor} ? '' : '0', showFooter => $inputs_ref->{showFooter} // '0', pretty_print => \&pretty_print, diff --git a/lib/WeBWorK/RenderProblem.pm b/lib/WeBWorK/RenderProblem.pm index d14b6e743..9cfeda9b7 100644 --- a/lib/WeBWorK/RenderProblem.pm +++ b/lib/WeBWorK/RenderProblem.pm @@ -80,7 +80,7 @@ sub process_pg_file { # just make sure we have the fundamentals covered... $inputs_ref->{displayMode} ||= 'MathJax'; - $inputs_ref->{outputFormat} ||= 'static'; + $inputs_ref->{outputFormat} ||= $inputs_ref->{outputformat} || 'default'; $inputs_ref->{language} ||= 'en'; $inputs_ref->{isInstructor} //= ($inputs_ref->{permissionLevel} // 0) >= 10; # HACK: required for problemRandomize.pl @@ -235,7 +235,7 @@ sub standaloneRenderer { problemSeed => $inputs_ref->{problemSeed}, processAnswers => $processAnswers, showHints => $inputs_ref->{showHints}, # default is to showHint (set in PG.pm) - showSolutions => $inputs_ref->{showSolutions}, + showSolutions => $inputs_ref->{showSolutions} // $inputs_ref->{isInstructor} ? 1 : 0, problemNumber => $inputs_ref->{problemNumber}, # ever even relevant? num_of_correct_ans => $inputs_ref->{numCorrect} || 0, num_of_incorrect_ans => $inputs_ref->{numIncorrect} || 0, @@ -356,7 +356,7 @@ sub generateJWTs { iss => $ENV{SITE_HOST}, aud => $inputs_ref->{JWTanswerURL}, score => $scoreHash, - problemJWT => $inputs_ref->{problemJWT}, + # problemJWT => $inputs_ref->{problemJWT}, sessionJWT => $sessionJWT, platform => 'standaloneRenderer' }; diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..07ea79ea4 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "renderer", + "lockfileVersion": 2, + "requires": true, + "packages": {} +}