Skip to content

WeBWorK 2.21 Release Candidate#2940

Open
drgrice1 wants to merge 357 commits into
mainfrom
WeBWorK-2.21
Open

WeBWorK 2.21 Release Candidate#2940
drgrice1 wants to merge 357 commits into
mainfrom
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.

dlglin and others added 30 commits November 4, 2025 12:55
Add the hidden authentication fields to the LTI update form.
…lure

Rework error handling when a problem fails to render in a test.
For the most part, there isn't much that is needed.  The javascript
files are no longer in the `es5` subdirectory, and the workaround for
changing the math renderer was removed (as noted in the comment above
it).

The `mathInteraction.pg` problem in the student orientation has been
updated, although further updates may be needed. The screen shots the
problem uses were updated, but someone else might need to create better
screen shots.  Mine seem to have come out quite a bit smaller than the
previous ones.

I removed the rather old examples of the `$pg{specialPGEnvironmentVars}{problemPreamble}`
 and `$pg{specialPGEnvironmentVars}{problemPostamble}` variables in
`defaults.config` and `localOverrides.conf.dist` that include examples
of doing things with MathJax that weren't even valid for MathJax 3. I
also made the deprecation statement for that variables stronger.

There is a minor css tweak in `system.scss` to ensure that the MathJax
expression eplorer help dialog is above the masthead and stick problem
navigation bar.

Further modification to the MathJax configuration (in
`htdocs/js/MathJaxConfig/mathjax-config.js`) may be needed as per the
discussion in issue #2828.  But that can wait until we have more
information.
Update MathJax to version 4.0.
There have been requests to either remove this extension or at least
make it so that those editing problems do not have it loaded, as it
makes it easier to determine what is wrong with TeX in a problem.

This pull request just removes the `noerrors` MathJax extension. So TeX
errors are shown for all users.

I am not sure why this package was added. It seems that I added it when
I upgraded from MathJax version 2 to version 3, but I don't remember
why.  Perhaps it was just in the configuration that @dpvc recommended,
or maybe I added it for some reason.  Perhaps it was just about
maintaining compatibility with version 2 of MathJax.  For version 2 (as
I understand it), the `noerrors` extension was included by default, but
with MathJax version 3 it must be explicitly loaded.

The change from the `webwork_url` to the `webwork_js_config` method in
the `WeBWorK::ContentGenerator` module is not needed for this, but
should be made anyway.  There is also a `webwork_url` method in the
`Mojolicious::WeBWorK` module that is already available for all
controller modules (since it is a Mojolicious helper method), and having
this other one overrides that one and it is confusing to have both that
return almost the same value.  The only difference is that
`WeBWorK::ContentGenerator` method called the `location` helper which
returns the empty string if the root URL is '/', and the `webwork_url`
helper returns '/' in that case. I don't know what I was thinking
creating the `WeBWorK::ContentGenerator` method which was really just an
alies for the `location` helper method anyway.
First, this adds the permission `webservice_render_problem`
used to determine if a user can render a problem with the
WebworkWebservice, instead of using the `proctor_quiz_login`
permission for this.

Second, this adds an additional permission `webservice_render_source`
used to determine if a user can render problems using the
problem provided with the request. The use case for this is to
allow users which can render problems only using a problem
filename, but not by providing the problem's source.

These permissions are both set to `login_proctor` to match
current behavior and are provided to allow server admins to
change which users can render problems. These permissions are
not added to the course configuration page as they are permissions
that should not be modified by most users, only server admins
via `localOverrides.conf` or `course.conf`.
Add permissions to render problems with WebworkWebservice.
Make MathJax show errors for bad TeX. (alternate approach)
…-config-alt

Revert "Make MathJax show errors for bad TeX. (alternate approach)"
There have been requests to either remove this extension or at least
make it so that those editing problems do not have it loaded, as it
makes it easier to determine what is wrong with TeX in a problem.

This pull request makes it so that these errors are only shown in the PG
problem editor. Actually they are shown any time the renderRPC endpoint
is used and the `showMathJaxErrors` parameter is set to a true value,
but the only time that webwork2 now does this is in the problem editor.

This still includes thhe change from the `webwork_url` to the
`webwork_js_config` method in the `WeBWorK::ContentGenerator` module.
There is also a `webwork_url` method in the `Mojolicious::WeBWorK`
module that is already available for all controller modules (since it is
a Mojolicious helper method), and having this other one overrides that
one and it is confusing to have both that return almost the same value.
The only difference is that `WeBWorK::ContentGenerator` method called
the `location` helper which returns the empty string if the root URL is
'/', and the `webwork_url` helper returns '/' in that case. I don't know
what I was thinking creating the `WeBWorK::ContentGenerator` method
which was really just an alies for the `location` helper method anyway.
Make MathJax show errors for bad TeX but only in the problem editor. (another alternate for #2837 and #2838)
The `webwork2.sty` file currently creates this link using the `\url`
command.  That command attempts to detect the link type.  In this case
that results in a file link.  Depending on the PDF viewer used, that
results in different behavior.  In Firefox's PDF viewer it behaves as if
it is not a link at all, but just text.  Clicking on it does nothing. In
Google Chrome's PDF viewer or Evince it is a link, but clicking on it
results in a message being displayed that the file does not exist.

So this switches to using the `\href` command instead. That requires
that both the link URL and link text explicitly be given, but reliably
results in a working link.
Fix the openwebwork.org link in hardcopy.
…browser.

There have been several complaints about Contrib problems being listed
first in the library browser.  Perhaps this will help to quiet those
complaints.

This is done at the database level, and so should be rather efficient.
The `@openwebwork/pg-codemirror-editor` and its dependency packages
`@openwebwork/codemirror-lang-pg`, `codemirror-lang-perl`, and
`codemirror-lang-mt` have all had all dependencies updated, and the
bracket matching issue reported in
openwebwork/codemirror-lang-pg#1 fixed.

The resulting changes have also been published.

This just updates webwork2's dependency so that those updated packages
can be used by webwork2.

Note, I did take some liberty by pushing the updates for the
`@openwebwork/pg-codemirror-editor` and
`@openwebwork/codemirror-lang-perl` packages without going through the
pull request process.  But with the tiered depencies here that would be
tedious to go through the approval process from bottom to top.
…ary browser persistent.

The status of the checks is saved to local storage and updated when the
page loads.  So whatever state they had the last time the page was open
is restored. Note that the settings are saved per user id and course.
So you can set the checks differently for each course.

This was (essentially) asked for in issue #2857.
Currently if `$permissionLevels{login} = 'professor'` and a user signs
in via LTI that would be assigned the role of "student", then webwork2
creates the user and signs the user in.  However, on subsequent LTI
logins authentication fails.  This refuses to create a user if the
requested role would not have permission to login.

Clean up the error messages some.  There is a lot of work left to
do on this. The LTIAdvance.pm module has an extremely poor design for
error handling and messaging to go with those errors.  The
LTIAdvantage.pm module is only a tad better (I largely just copied the
poor design of the LTIAdvanced.pm module).  The `log_error` key is set
and appended to numerous times, frequently resulting in a long run on
message that doesn't really make sense. Also, there were some of these
errors that were adding "LOGIN FAILED".  That was removed because The
`Authen.pm` code always prepends that and that resulted in logs with
"LOGIN FAILED LOGIN FAILED ...".

The `authenticate` method is expected to return either 1 or a message
indicating the failure.  Currently it returns either 1 or 0.  As a
result the messages that are set in the `authenticate` method go into
the abyss.  Those messages should be returned instead of setting
`$self->{error}`. Note that the method can still return 0 if no message
should be set (as in the case of the OAuth token failing to verify for
LTI 1.1).

For LTI 1.3 make sure that the fallback_source_of_username is set before
attempting to use it. Otherwise the claim extraction fails and it
results in a database error later.

Fix a minor issue in the authen_LTI.conf.dist file.  The
permissionLevels lines should end with semicolons, not commas.
The option is `extra_ssl_headers` in the `conf/webwork2.mojolicious.yml`
file.  It works just like the `extra_headers` option, except that the
headers are only added to responses to secure requests.

This is to address a need to add the `Strict-Transport-Security` header
to SSL request responses that was brought up in the forums.  See
https://forums.openwebwork.org/mod/forum/discuss.php?d=8782#p22468. That
header should not be added to non SSL requests.
This is simply the result of executing `npx update-browserslist-db@latest`.
Don't create users for LTI users that do not have permission to login.
When MathQuill was switched to a published npm package instead of being
used from the Github repository, the `node_modules` location changed.
This was all updated on the PG side of things, but I forgot to do it for
the problem grader (which is the only place MathQuill is used for
webwork2).
Instead of erroring out due to hash keys not existing, just give a message
"You do not have permission to list assignments in this course." when
when a user doesn't have the `navigation_allowed` permission but
`LTI` is not configured.
Instead of greying out the "Use Achievement Reward" button when
acting as another user, which only lists the available achievement
items to use, grey out the actual use button to let an instructor
be able to view which items a student could use on that assignment.

It is still not possible to actually use an achievement as another
user if that button was active, and further the form tags are also
removed from the list of items.

This address #2856.
Fix the MathQuill usage on the problem grader page.
Add message when navigation is not allowed and LTI is not configured.
Allow viewing achievement items when acting as another user.
Order problems from the OPL before those from Contrib in the library browser.
Make the "Include OPL" and "Include Contrib" check states in the library browser persistent.
Alex-Jordan and others added 30 commits May 17, 2026 22:00
Fix division by zero in {Full,Half}CreditSet Items.
Fix the `change_user_id` script for the case that a user does not have a password.
The colors for this were inline style.  Colors cannot be inline anymore
since the server cannot detect if the user will have the browser in dark
mode or not.  So this switches to using Bootstrap alerts instead.
Fix colors on the proctor login page for dark mode. (Bootstrap alert aproach)
Now that the student nav is on every set and problem page there is a
need to make the retrieval of all users assigned to the set faster.  I
noticed in a large class with more than 25,000 users this is quite slow
now.  It takes about 8 seconds for each page to load.  The problem is
the query is passing all of the user ids of those assigned to the set to
the `getUsersWhere` method.  That means that `SQL::Abstract` has to
process all of those and compile a rather long sql statement.  That is
slow.  So this breaks the list of user ids into chunks of 500.  For the
class with more than 25,000 users this drops the page load time to just
under 2 seconds.  Stil not great, but considerably better.

On my production placement exam server that has just over 32,000 users
it currently takes more than 35 seconds for each page to load.  With
this pull request it drops the time to about 8 seconds.  Again, not
great but considerably better.  Clearly the placement server is not as
fast as my local computer also.

Note that for classes with less than 500 users this won't change
anything.

Also note that this is only an issue for those that have the student nav
shown.
This was suggested by @Alex-Jordan, and does seem to be much better.
This set has nothing of value in it anymore.  The problems are really
not what we want problem authors to use as a model for new problems.

It is time for this set to go.
This was a remnant of my first approach for the Demo set of moving it to
`assets/pg` and using a link in the model course, and then rewriting all
of the problems using modern techniques. This link should not have made
it into #2979.
Remove a symbolic link accidentally added in #2979.
Improve the speed of the database user retrieval for the student nav.
I used the wrong thing in #2975.
Add `$achievementExtensionFactor` setting that is used to configure
the length of extensions. This works as a multiplicative factor, by
multiplying the base time (either 24 or 48 hours) by the factor. The
extension time is always rounded to the nearest hour, and cannot be
less than a single hour (two hours for the super extensions).

This affects all items that have an extension time.

* ExtendDueDate
* ExtendDueDateGW
* ExtendReducedDate
* ReducedCred
* RessurectGW
* RessurectHW
* SuperExtendDueDate
* SuperExtendReducedDate
Store the setID of all completed sets in the globalHash when
evaluating achievements. This allows achievements to use this
data vs just counting the number of completed sets. One use case
is being able to exclude optional sets, such as review sets, from
some achievements without completely excluding them from all
achievements.

In addition saving all the setIDs can avoid a double counting
completed sets, as there is currently no check to ensure a set
is not counted multiple times.
The code and rendering panels are now not only vertically resizable, but
are horizontally resizable when the window with is at or above the large
breakpoint (992 pixels).

Furthermore, resizing does not work with the native browser resize via
the css `resize` property. Instead it is controlled with JavaScript.
The resize grips (which are much more visible now) can be also be
focused with the keyboard and when focused the arrow keys can be used to
resize the code and render panels. Note that if `Ctrl` is pressed with
an arrow key a 1 pixel resize occurs, and if `Alt` is pressed with an
arrow key a 50 pixel resize occurs.  Without a modifier key the arrow
keys perform a 20 pixel resize.

In addition, the dimensions are saved to local storage and persist when
the page reloads. Unfortunately there will be some flickering of content
as the resize occurs after the page loads.

Note that the css `resize` property is actually not supported in all
browsers, so this actually makes resizing work for those browsers as
well.  The browsers that do not support the css `resize` property
include Firefox for Android, and Safari on IOS. Yeah, those are for
mobile devices, and who edits problems on a mobile device?  In any case,
this makes the resize grips more evident.  The native resize grip is
rather small in the lower right corner of the CodeMirror editor panel,
and many probably don't even know it is there.

Note that the code panel has a minmimum width of 400 pixels, and the
rendering panel a minimum width of 300 pixels.  This works out so that
when the window size is 992 pixels the two panels can't really be
resized much or at all (when the site navigation menu width of 250
pixels is taken into account) depending on the browser. But at larger
window widths resizing can be done.

I thought about making it so that the resizing could go all the way to
the right and the rendering panel be resized to a width of 0, but
decided against it.  If that were done, then the rendering would still
be occuring even though you can't see it, and that doesn't seem good.  I
think that this should at least alleviate the request(s) to hide the
rendering panel (which I don't think is really a good idea).
Better keep track of which sets are complete in achievements.
Rework resizing of the problem editor.
This replaces the Grades page for students with a new layout
designed for students. The old grades table is still available
to instructors under "Student Progress". Being a grade page
for students, instructors see the same info a student would
(no hidden sets or grades are shown for instructors acting as
a student). The only difference for an instructor is the student
navigation menu is shown to switch which student to act as.

The assignments are split into categories. Open assignments,
reduced scoring assignments (if reduced scoring is enabled),
and closed assignments. Assignments are ordered using the
same `byUrgency` logic as the ProblemSets page.

The total grade, if configured to be shown, is shown at the
top of the page for all sets that are past the open date.

Each assignment is a list item which shows the total score.
For tests the best test version score is shown if the student
can see the score. Then a table which includes the total score
and status for each problem in the set. For just in time,
only top level problems are shown. For tests, only the best
test version is shown.

The old Grades page code is moved into StudentProgress.pm
where it is still used.
Suggested by @Alex-Jordan, add the weights to the grade page and
then add buttons to hide/show the weights. The buttons use local
storage to save the state. The default state is to have the
weights and attempts hidden. Since the toggle happens at page load
the change is noticed when the page loads if not using the defaults.

Also put the version and score on a single row to save height
and a little bit of refactoring of adding the problems for each
set to save duplication of code.
* Add "mb-3" to give a bottom margin on the list group items+
* Indent code properly.
* Make versions taken statement a parenthetical.
* Remove version count and 'for' from link.
* Remove use of DOM content loaded event.
Replace the student grades page.
Cleanup and update the default achievements in the modelCourse.

* Remove the same comment from the bottom of all evaluators.
  This is hard to maintain, instead put all the information in
  achievements_readme.txt and point to this file from other
  evaluators.

* Cleanup the achievement evaluators:
  * Simplify the code, don't use else statements when there was
    a return inside the previous if. Clean up some of the logic.
  * Take advantage of the new $globalData->{completedSetIds} hash
    to avoid looping through all problems to determine if a
    set is completed.
  * Ran perltidy on them using an 80 character limit.

* Remove some evaluator duplication. The complete n problems
  or n sets can all be done using a single evaluator, since
  the only difference is the $maxCounter setting from the
  achievement.

* Remove all unused achievement evaluators. There are lots of
  these that are really just the same example achievement over
  and over again to see if particular problems from particular
  sets were completed. The images are still available for
  helping people think of names, but the evaluators don't need
  to be included. Instead provide four example evaluators for
  completing specific problems and/or sets.

* Add perltidy of .at achievement files to the run-perltidy
  dev_script and the github workflow.
All are updated to the latest versions except for iframe-resizer (which
we are locking at the current version for now).  There are no changes to
the code needed for our usage of these libraries.  The Bootstrap `if`
usage in sass is deprecated and warnings about that needed to be
silenced.
This seems to be needed for the latest updates.
Update npm dependencies to latest versions.
Cleanup modelCourse achievements.
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.

5 participants