Skip to content

Conversation

@drgrice1
Copy link
Member

PreTeXt needs this for its interactive problems.

@pstaabp
Copy link
Member

pstaabp commented Jun 23, 2022

This looks fairly straightforward. Not sure how I could test though. Thoughts to do this? Or I could just give a thumbs up.

@drgrice1
Copy link
Member Author

This basically does the same thing that the standalone renderer does for webwork3. To test this you could load a problem using the raw output and see that the output contains the list of js and css files with hashed names. You can also open a problem in the homework sets editor or library browser to see that the other formats still work correctly.

@Alex-Jordan
Copy link
Contributor

I have this on a branch. Plus Glenn's corresponding edits to the PreTeXt repo file pretext-webwork.js, plus a few edits of my own. And it's basically working as here:

https://spot.pcc.edu/~ajordan/temp/webwork.html

There's some cosmetic stuff on that page to continue working through. For example I think we will drop the "Correct" and "Incorrect" messages in favor of something more subtle. But it looks like it's functional.

In related news, it's working on Runestone. So if that page is part of a book in a Runestone course, the reader can do the exercises as they read and the score, feedback etc gets recorded by Runestone. Brad and I just tested that literally two minutes ago.

@drgrice1
Copy link
Member Author

I see that you found a better icon for the message button than the speech bubble we used before!

One thing that isn't working right yet is the Correct/Incorrect messages in scaffolds. If the scaffold is closed, then the popover messages are still there floating over the closed scaffold. Although, if you are going to replace those popovers, then that will fix the issue.

@taniwallach
Copy link
Member

Maybe the raw output mode could also include either the data collected in @CSSLoads and @JSLoads which have the hashed names of the standard dependencies or a JSON structure similar to that added in the PR but for those files which get data about them in @CSSLoads and @JSLoads?

@drgrice1
Copy link
Member Author

@taniwallach: I am not sure what you mean exactly.

@taniwallach
Copy link
Member

@taniwallach: I am not sure what you mean exactly.

The new asset build systems changes the names of the "standard" JS/CSS files included by all problems when a new build is made. As a result, a remote system cannot know what the correct URLs for those files will be.

To handle that change, in #1599 you moved the JS/CSS load lines in the lib/WebworkClient/simple_format.pl (and other "regular" format files) to lines which are added to $problemHeadText by code in lib/FormatRenderedProblem.pm which depends on the @CSSLoads and @JSLoads. That approach provides the current URLs for the "regular" formats of html2xml. The json format gets both those arrays provided as part of the provided JSON structure, but it does not seem that data was added anywhere in the raw format.

My proposal is to also add the data in those arrays (or something similar) to the raw format. Ideally, the structure being used would be similar to what is being done in this PR for JS/CSS files requested by the PG code.

@drgrice1
Copy link
Member Author

I am confused. This pull request adds that data to the raw format.

@drgrice1
Copy link
Member Author

I see. You are specifically talking about the @CSSLoads and @JSLoads. Really, you shouldn't need that. All of those are specific to webwork2 theming and or third party inclusions. In most cases anyone using the raw format should either provide anything there that is needed from other sources (served elsewhere like a CDN).

@taniwallach
Copy link
Member

I see. You are specifically talking about the @CSSLoads and @JSLoads. Really, you shouldn't need that. All of those are specific to webwork2 theming and or third party inclusions. In most cases anyone using the raw format should either provide anything there that is needed from other sources (served elsewhere like a CDN).

OK. Point accepted, so long as you are certain it is only theming and third party files.

@drgrice1
Copy link
Member Author

This is the approach at this point at least. This is related to the comments on line 172 and 215 of pg/macros/PG.pl. The point is that the files mentioned in the comments there are third party files. In most cases those can be used from a CDN. In some cases the "requestor" as I call it in the comments there may even need to use custom versions (for example the bootstrap.css and bootstrap.js files). This is also the approach the standalone renderer is going to use for these. Webwork3 needs to use a custom bootstrap.css file that does not conflict with Quasar.

The other files added to the @CSSLoads and @JSLoads lists in FormatRenderedProblem.pm are for theming. Note that the math4 files no longer contain anything for rendering problems. That has all been moved to pg/htdocs/js/apps/Problem/problem.scss, and that is included in the @extra_css_files.

@Alex-Jordan
Copy link
Contributor

My previous link should no longer work. But here is where I intend to keep samples that are up to date:

https://spot.pcc.edu/~ajordan/temp/pretext-webwork

@Alex-Jordan
Copy link
Contributor

Although, if you are going to replace those popovers, then that will fix the issue.

I plan to make it so that the "Correct!", "Incorrect", and "90% correct" (etc) titles go away. Instead, inside the input field there will be an indicator like when you are filling a form and you try to submit some input that does not validate.

So then there will still be popups but only for any extended feedback. It'll reduce the popup presence a lot and I'll check out the scaffold issue then.

@taniwallach
Copy link
Member

@Alex-Jordan - Is this ready for merging in your opinion?

Copy link
Contributor

@Alex-Jordan Alex-Jordan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been working in my experiments/development of PreTeXt WeBWorK integration for 2.17.

@Alex-Jordan
Copy link
Contributor

@taniwallach Yes, I think so.

raw format.  PreTeXt needs this for its interactive problems.
anyone using the format wants that information.
@drgrice1
Copy link
Member Author

I have added the other css and js files to the raw output mode as well as @taniwallach requested. PreTeXt does not need those, but others using the raw format might.

Copy link
Member

@taniwallach taniwallach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drgrice1 Thanks for data on the adding the third party css and javascript to the raw format output.

@taniwallach
Copy link
Member

This had @Alex-Jordan's OK as providing the changes needed for PreTeXt with WeBWorK 2.17. With the final release impending - I'm merging this.

@taniwallach taniwallach merged commit 446c51b into openwebwork:WeBWorK-2.17 Jul 15, 2022
@drgrice1 drgrice1 deleted the pretext-changes branch July 18, 2022 12:32
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.

4 participants