-
-
Notifications
You must be signed in to change notification settings - Fork 166
Update the other formats with the features added to the simple_format in #1301 #1329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the other formats with the features added to the simple_format in #1301 #1329
Conversation
6556b4e to
546a096
Compare
pull request openwebwork#1301. There are also a few tweaks to the simple format as well. Mainly just adding the answer blank coloration (but only if it is not an answer preview and is a submit or check answers).
546a096 to
bb54ee2
Compare
|
This looks good. |
|
Just to reference @Alex-Jordan's other JSON output - it is the "raw" format from #1120 The |
the submit buttons. They are all shown by default (as it was before). This is implemented for the standard, simple, sticky, and json formats. It does not apply for the others. To hide the buttons add the GET or POST parameters `showPreviewButton=no`, `showCheckAnswersButton=no`, or `showCorrectAnswersButton=no`. The simple2 format is removed as this makes that format pointless.
5eb8866 to
7edd635
Compare
format and clean that up a bit. Separate the translator warnings (that don't really exist) and the perl warnings that come from pg that are sent on from renderProblem.
an array of URLs to be used in href, rather than sending the full HTML code to load them. The JS loads which need the "defer" attribute were split from head_part200 into head_part201, and one of those loads /webwork2_files/mathjax/es5/tex-chtml.js should also get id="MathJax-script" in the <script> tag. The creation of suitable HTML code, including the addition of defer and id attributes where needed should be done on the side processing the JSON data. Fixed the lines using $themeDir to be in single quotes so the variable interpolation will be done properly later on, when that variable is available.
taniwallach
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@drgrice1 - Great stuff. Tested and mostly working.
- The formats:
simple,debugandstickyall seem to work as expected. sticky's use of local storage to save the last answers seems fine.However, I do not see colors in the results table for thestickformat. I think this is worth fixing, unless it requires an inordinate amount of effort. I did not look into why it does not work now.jsonneeds some small changes, and this is also a chance to replace the JS and CSS loading data with arrays of the addresses, rather than a block of full HTML code as recently discussed. I made a PR drgrice1#3 to the branch of thus PR with what I think needs to be changed for thejson_format.
Two more minor comment - which need not hold back merging the improvements:
- Why use
nofor the new settings like:showPreviewButton=no? Maybe at least allow0also for no? - For
showCorrectAnswersButtonmaybe the default should benoalthough that changes the existing default behavior.
I see what you see. I will look into it.
Your pull request looks good. I will merge it. More could be done here. I think that instead of using prefixed keys for the hidden inputs like
I am fine with using '0' instead (I think). I would rather not allow multiple settings as I don't want to overly complicate the code in FormatRenderedProblem.pm.
I would rather not change the existing default behavior unless there is a consensus to do so. |
…-array Patches for openwebwork#1329
theme javascript files twice. This was a cut and paste error in an earlier commit.
or any of the submit buttons.
|
@taniwallach: I have addressed all of the things you mentioned except the default behavior for the show correct button. I am fine with making that change, but I will let others weigh in on that idea first. @Alex-Jordan: You probably use the html2xml formats more than most others. What do you think of defaulting to not showing the "Show Correct Answers" button. |
problem in webwork. This is so that the javascript in mqedit.js (for MathQuill answers) picks up on it and enter triggers a preview. Also fix some errors in the localstorage.js javascript for the sticky format.
Done in drgrice1#4
Thanks!
I agree. If there is such a consensus it can be changed later. |
16a68a1 to
1963133
Compare
|
@pstaabp - I think this is ready to go, except the possible change to the default. Could you take a look? |
FormatRenderedProblem and in the formats.
Update the other formats with the features added to the simple_format in #1301
| <link rel="stylesheet" type="text/css" href="/webwork2_files/themes/math4/math4.css"/> | ||
| <link rel="stylesheet" type="text/css" href="/webwork2_files/css/knowlstyle.css"/> | ||
| <link rel="stylesheet" type="text/css" href="/webwork2_files/js/apps/ImageView/imageview.css"/> | ||
| <link rel="stylesheet" href="$themeDir/math4.css"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something about this is not working. Here is the AIM server, now using 2.16. For normal use, things appear to be OK. But for using the simple format, $themeDir is resolving as the empty string, as you can see in the source of the page below. So the CSS and js is not loading. Here is an example page:
I've searched through the config files and I can't find something that should fix this. $themeDir is defined with my $themeDir = "$ce->{webworkURLs}{htdocs}/themes/$theme"; in FormatRenderedProblem.pm. And in defaults.conf, I find $webworkURLs{htdocs} = "$webwork_htdocs_url";. And in site.conf I find $webwork_htdocs_url = "/webwork2_files";. But I have trouble seeing how $themeDir resolves as the empty string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied the line
my $themeDir = "$ce->{webworkURLs}{htdocs}/themes/$theme";
in FormatRenderedProblem.pl down to immediately before the interpolation at line 357, and now things work. So something is not working with its original location at line 130.
|
I am not able to reproduce this. Even going to the link that you posted seems to work. This may be because you have made the change you mention on your server. Although, I also can't see how making that change would fix anything. That variable depends on the |
|
Yes, it fixed once I copied line 130 to line 357, but that is all I did. I will use a different server to try to cleanly reproduce it. |
|
I'm not able to reproduce it on the next server I tried. And I deleted the line I pasted in the AIM server, restarted apache, cleared cache, and I can't reproduce it there now either. Note that the issue as I understood it is not about should leave I was getting lines like OK, well nevermind then. I'm never sure if caching somewhere is messing with me. If it comes up again, I will carefully try to make it happen in a reproducible way on some other development server. |
|
There is certainly something odd that occurred. |
@pstaabp observed that there were improvements made to the simple_format in #1301, and suggested that those be added to the other formats as well. So this does that.
There are also a few tweaks to the simple format as well. Mainly just adding the answer blank coloration (but only if it is not an answer preview and is a submit or check answers).
This now also adds theme selection to the formats which fixes #1335.
This also now makes it possible to hide any of the submit buttons in the formats if desired. To hide the buttons add the GET or POST parameters
showPreviewButton=no,showCheckAnswersButton=no, orshowCorrectAnswersButton=no. The simple2 format has been removed, as this is all that it does that the simple format does not anyway.Final addition: The standard format is deleted, and the debug format is beefed up to replace it.