Skip to content

WeBWorK 2.21 Release Candidate#2940

Open
drgrice1 wants to merge 278 commits intomainfrom
WeBWorK-2.21
Open

WeBWorK 2.21 Release Candidate#2940
drgrice1 wants to merge 278 commits intomainfrom
WeBWorK-2.21

Conversation

@drgrice1
Copy link
Copy Markdown
Member

This is the release candidate for WeBWorK 2.21. Please re-target any pull requests that you want to get into the release for this branch.

drgrice1 and others added 30 commits June 2, 2025 14:07
Importing the `default_achievements.axp` file into a course with no
achievements and 5000 users and assigning to all users took about 8
minutes with the WeBWorK-2.20 branch.  With this pull request the time
decreased to about 20 seconds.
…HTML renderer.

This is an alternate for #2734, and implements the workaround suggested
by @dpvc in mathjax/MathJax#3370 (comment).
The script now uses the settings in the course environment for external
programs and to check the database driver (DBD::mysql or DBD::MariaDB).
In order for that to work, first the script checks that all of the
needed modules are found, load, and are at the sufficient version. That
is except for the database driver module.  If any are not found, then
the script exits with a message stating that it is unable to continue
without the required modules.

If all modules are good, then the script checks the database driver
module next. For this it "runtime" loads the course environment and its
dependencies (as well as a runtime detection of the webwork2 root and
lib directories).

This is to address issue #2740.

In addition the following modules are removed that are no longer needed:

* Array::Utils
* Email::Sender::Simple - still used but is a dependency of Email::Stuffer and doesn't need to be checked separately
* HTML::Tagset
* HTML::Template
* IO::Socket::SSL
* Net::LDAPS
* Net::SMPT
* Net::SSLeay
* PadWalker
* Path::Class
* Safe - we use our local version (WWSafe.pm) and still check Opcode which it uses
* Statistics::R::IO
* Template

`npm` is added to the list of required applications.

Most of these things were noted in issue #1917.
The script now uses the settings in the course environment for external
programs and to check the database driver (DBD::mysql or DBD::MariaDB).
In order for that to work, first the script checks that all of the
needed modules are found, load, and are at the sufficient version. That
is except for the database driver module.  If any are not found, then
the script exits with a message stating that it is unable to continue
without the required modules.

If all modules are good, then the script checks the database driver
module next. For this it "runtime" loads the course environment and its
dependencies (as well as a runtime detection of the webwork2 root and
lib directories).

This is to address issue #2740.

In addition the following modules are removed that are no longer needed:

* Array::Utils
* Email::Sender::Simple - still used but is a dependency of Email::Stuffer and doesn't need to be checked separately
* HTML::Tagset
* HTML::Template
* IO::Socket::SSL
* Net::LDAPS
* Net::SMPT
* Net::SSLeay
* PadWalker
* Path::Class
* Safe - we use our local version (WWSafe.pm) and still check Opcode which it uses
* Statistics::R::IO
* Template

`npm` is added to the list of required applications.

Most of these things were noted in issue #1917.
This was removed when the uploads were reworked, but I see now that it
should not have been.  Without this a warning about the empty string not
being a valid upload occurs if there is not an upload.
Any time an achievement is created a warning is now displayed.  This is
due to an incorrect check for `$@` without a preceeding `eval`. This
pull request adds the appropriate evals and corresponding checks for
exceptions in `$@` which removes the warnings.

Also, the delete handler was not correctly maintaining the
`visibleAchievementIDs` list.  As such, if you create an achievement,
delete it, and then create an achievement with the same achievement ID
again, two copies of the achievement are shown in the list (although
only one actually exists in the datbase).  So the delete handler now
correctly maintains the `visibleAchievementIDs` list.
This method is not used, and definitely never should be.  The method was
intended to be used in a maketext call with `[tense,_1,present]` or
`[tense,_1]`.  If `present` is given then 'ing' is appended to the given
interpolated value, otherwise 'ed' is appended.  However, there is no
possible way that will be valid for most languages other than English,
and hence this was entirely invalid to use and should not exist. This
method is a carry over from the original code here which was copied from
the `Locale::Maketext::Simple` package.
…problem editor.

This ensures that the given file name has the same valid characters that
the file manager requires.

Show the message "The text box now contains the source of the
original problem. You can recover lost edits by using the Back button on
your browser." any time that a save is not going to be done in the
save_as handler, since it applies to any of those cases.

Only set the `editFilePath` when a save really will occur.

Finally, don't show the "File "[_1]" exists. File not saved. No changes
have been made." message if no file name is given.

This fixes issue #2754.
…comma fix.

This fixes issue #2739.

Prior to this pull request something like `my $a = { y => 1, b => 2, c => 3 };`
would have syntax highlighting issues because it was being recognized as
the transliteration `y=>1,b=>2,c=` with the quote like delimiters being
the equality symbol.

This is not exclusive to the `y` transliteration operator.  The same
could happen with any of the quote like operators (`q`, `qq`, `tr`,
etc.).  For example, `my $a = { q => 1, b => 3 };` had the same problem.
It would be recognized as the single quoted string `q=>1,b=` with the
equality symbol again being the quote like start and end delimiter.

Of course with this pull request the `=>` is properly recognized as a
fat comma.
The OPL and Contrib no longer contain any set definition files, so there
is no point in this code. It doesn't do anything anymore.

This means the checkboxes shown on the "Sets Manager" import tab and
the "Set Definition Files" page of the "Library Browser" are gone.

Also, the script to search for set definition files in the OPL and
Contrib is removed. All of the places where that script was called are
deleted. The code utilizing the data in the set definition JSON files
that were generated is gone.
…grading.

This finishes @Alex-Jordan's work in #2750, and checks for missing
symbolic links in a course's templates directory when checking if
courses need upgrading, and creates the missing links when upgrading the
course.  If a symbolic link points to an incorrect location (as defined
in the course environment), then the upgrade process attempts to delete
the symbolic link and recreate it pointing to the correct location.

Note that the check for permissions of the symbolic links has been
removed.  For symbolic links there are two permissions in consideration.
Those of the link itself, and those of the link target.  The permissions
of the link itself cannot be changed.  Even the linux command line
`chmod` utility cannot do this (contrary to what Google AI wants to tell
you, there is no `-h` option for `chmod`).  Furthermore, linux
completely ignores symbolic link permissions, and doesn't use them at
all.  So the only permissions that really matter are those of the link
target which linux does use.  However, the directories that are the
target of these links do not belong to a particular course.  They are
system directories (or part of the webwork2 installation), and setting
the correct permissions on those is part of the installation of
webwork2. It should not be part of a course upgrade process. Including
these permissions in the upgrade report when not correct would actually
mean that every course would show that it has the incorrect permission,
or no courses would. Upgrading would never fix this, because the
permissions for these directories cannot be changed from the user
interface in any case.  What could be done here is to make another admin
page that does a system status check, and lets the admin user know what
directory permissions in the webwork installation are not correct what
needs to be fixed. Of course the `setfilepermissions` script can be used
to fix these permissions (it already handles most of the directories in
question).
Also fix the logic both here and when archiving a course for the
possible combinations of the directories, links, and database needing
repair.  With the previous logic if the directories were good, but the
database tables and links both needed repair, then the button said
"Attempt to upgrade directories and links".  However, in actuality if
that button were used, the server would both repair links and repair
database tables.  Now, anytime the database tables need repair the
button says "Upgrade Course Tables" regardless of the state of the
directories and links. This is not ideal since directories or links
might also be repaired in this case, but the important thing to show is
the database repair which is more important than directories and vastly
more important than links.
This PR has two related features
1. A script in `dev_scripts` to parse all of the sample problems and the POD to build up a "database" of non-common words for a given problem/POD page.
2. Add search boxes to the sample-problems/POD pages to return pages that match the search criteria.

Parse the POD from macro files .

improve the search and add a "no results"

Also add ww-update script to call OPL-update and build-search-json.pl
This is a rework of #2733.

This does not add any scripts that need to be run when webwork is
installed or upgraded.  Instead the search data is dynamically
generated.  The first time that the sample problems home page is loaded
all PG macros and sample problems are parsed and the search data
extracted.  Then the data is saved to the
`DATA/sample-problem-search-data.json` file. This takes less than half a
second on my computer, but that will probably vary some depending on the
server's processing capabilities. The last modified time of each file is
also saved in that search data.  On subsequent requests the last
modified time is checked, and a file is only parsed again if it has been
modified since the last time the page was loaded.  If a file is deleted
from PG, the data is removed from the file.  So even in development the
data will always reflect the current state of the PG repository on the
server.  Subsequent requests when no changes to PG occur usually
complete in around 1/25th of a second. A change of a single file
increases that time only slightly.

Note that the search data is accessed by JavaScript via the new
`/sampleproblems/search_data` route.

The layout of the sample problems home page is changed considerably
from #2733.  The layout now works on narrow screens and some
accessibility and html validation issues were addressed.

There is also quite a bit of improvement in the search data that is
saved.  There is no attempt to single out methods or functions for
macros from the POD headers.  Unfortunately, that was never really going
to work.  Instead the words from all headers (that are not stop words)
are used.  So the methods or functions that are in a POD header will be
in the search data, but other things will also be there.  There are some
custom stop words added that are not desirable in the search data, like
"description", "synopsis", "podlink", and "problink".

Also, macros that don't have POD in them are not indexed at all since
there isn't anything to show for these files.
…er Log).

If MathQuill is enabled and a student types `"<script>alert(1);</script>`
and submits the answer, then that script is executed if an instructor
views the answer on the past answers page.  If MathQuill is not enabled,
and a student simply enters `<script>alert(1);</script>` the same thing
happens.

This is due to a change in #1899 to make the special character `&#1970;`
used to separate array answers (usually coming from checkbox answers)
display correctly.

To fix this better handling of answers with that character is needed.
So this splits the student answers on that character, and now DOES html
escape all other parts of the student answer again, but directly inserts
the `&#9070` characters without escaping. The effect is that answers
will still be displayed the same as they were before other than scripts
in the answer. Those will now actually appear as text. Note that is the
same as it would have been before #1899.
Update the LTI Mass Update page to allow updating either all users
or a single user for multiple sets with a single update. To be able
to determine if all sets for a specific user are selected or not,
refactor the database calls to get the list of all users and their
assigned sets as part of the initialize method.
There are some new strings that have not been added to the pot file.
Currently the session parameters are set at the beginning of each
request.  However, if another request occurs for the same process before
the first request completes, then the session for the first request gets
saved with the parameters of the second request.  This is because there
is only one Mojoicious session setup for the entire app and the session
parameters are global for the process.

To fix this the session parameters need to be set again at the end of
the request just before the session is saved.

This is only an issue if there are multiple clients per worker process.
Of course that is not the case at this point, but hopefully will be some
day.
drgrice1 and others added 30 commits March 10, 2026 13:17
…ing sets from the "Sets Manager".

This restriction was removed when editing the set detail page several
releases ago (if I recall correctly).  However, the restriction was not
removed on this page.  So this make this page consistent and this should
have been done at that time.
This is the result of running `npm audit fix`.
Remove the restriction that a close date be within 10 years when editing sets from the "Sets Manager".
Add the completed time next to the time taken on completed test versions.
Move the set description from a tooltip on the link to the set to
a tooltip on an info button located just right of the set link if
the set description is not empty.

This adds an additional option to the `set-id-tooltip` class
JavaScript that if `data-fallback-placements` is set as a spaced
separated list list, that list will be passed to the bootstrap
Tooltip on creation.
The student statistics and student progress page are identical.
Remove the student statistics version of the page, since the page
doesn't provide any summary of the data, and only shows a student's
number of attempts and grade.
The only shared code is a new template which just links to
all sets. The problem links or student links are put in each
pages siblings template.
ProblemSets: Place set description in info button.
Add completed time to test output.
Remove the copyright/license from README.md.

Clarify that the artistic license is version 1.0 and provide links
to the copy on github and the perlfoundation.

Remove the old FSF physical address and provide links to the
GPL license on github and a direct link to the gpl version 2
on gnu.org (since the old link resolved to version 3).
Since we are now on MathJax 4.1.1 and the version specified in the
`bs-color-scheme.js` file is 4.1.0, a console warning points out the
version mismatch.

We will need to remember to change this every time we upgrade MathJax.
Of course the extension will also need to be updated for changes to
MathJax.
Node 18 is deprecated, and our dependencies now require node 20 or
newer.
This is the result of executing the
`bin/dev_scripts/update-localization-files` script.
Make `check_modules.pl` check for node version 20 or newer.
…-version

Change the version of the `bs-color-scheme.js` MathJax extension.
Clarify messages in extension achievement items when reduced scoring is enabled
The PG messages are now dealt with completely separately from the
webwork2 general warning handling. Furthermore PG warnings and debug
messages are separately dealt with.

The PG `internal_debug_messages` are no longer dealt with at all.  They
are unnecessary and inappropriately named, and will be removed from PG.

Also, handling of the warnings is now much more consistent in all of
the different places that problems are rendered. In fact, they all use
the new `templates/ContentGenerator/Base/problem_warning_and_debug_output.html.ep`
template for this.

All of this output is no longer wrapped in a `code` tag.  That is the
wrong thing for this. None of it is code. It also causes problems with
openwebwork/pg#1384.
Yes, this is the same one the dependabot pointed out for the main
branch.
Fix an npm dependency security vulnerability.
The `switchToBSStyle` method should be called on the `commonStyles` key
of the `CHTML` object rather than the object itself (which is actually a
function).
Fix an issue with MathJax CHTML mode.
Rework PG error/warning/debug message handling.
Add a point input field to set the problem score in the ProblemGrader.
This is the same as what is being used in the SingleProblemGrader,
and honors the same setting to show it or not. The input uses
JavaScript to update the actual score which is what is submitted
when the grader is saved. If the percent score is not shown, a hidden
field is used instead.

This also adds a step of 1 to the percent score and validation on
both the percent score and point score values.
Add point input to ProblemGrader.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants