WeBWorK Problems

Draggable proof macro

Draggable proof macro

by Robin Cruz -
Number of replies: 6
I've noticed a problem with the DraggableProof.pl. I want to put a draggable proof in a PreTeXt book I'm working on as a Checkpoint problem--the problem works fine in a regular WeBWorK course, but not in the text where the problem is not associated with a person or course. I don't think it's able to load jquery.nestable.js that seems to be required for the Draggable proof to work.

I tried using the latest version of DraggableProof.pl from git, but with this version, the problem will not work in the course or the text. Alex Jordan has worked with me from the PreTeXt side and suggests that this may be more of a WeBWorK issue with the macro. To see what is happening, here is a link to an OPL draggable proof problem:

Here is another using the AIM server instead of the College of Idaho server:
In reply to Robin Cruz

Re: Draggable proof macro

by Alex Jordan -
I think that the "simple" format for the XMLRPC response is not loading some component that the draggable proof javascript needs. We are wondering if someone familiar with either thing (XMLRPC or dragganle proof js) can weigh in on how to get this working.
In reply to Alex Jordan

Re: Draggable proof macro

by Ping-Shun Chan -
This is apparently also an issue with Gateway quizzes:


Browsing through the code, it seems the draggableProof macro loads the main javascript code through the "post_header_text" function.

Curiously, this function is present in lib/WeBWorK/ContentGenerator/Problem.pm, but missing in:

The GWQ case seems to be relatively simple, adding one line like:
print CGI::div({class=>"problem-header"} ,$pg->{post_header_text}) if $pg->{post_header_text};
appears to work. (But this is just a proof of concept, I don't know if it'd break anything else.)

In the XMPRPC case:
For the post_header_text data of the pg file to be passed onto WebworkClient/simple_format.pl, for example, it appears one has to alter at least the following files:


My question is, was there perhaps a reason not to pass on the post_header_text in the first place?
In reply to Ping-Shun Chan

Re: Draggable proof macro

by Glenn Rice -

Making this work for the webwork clients is a matter of passing the post_header_text through to the WebworkClient.  I have attached a patch that does this.

Alternately, you could modify the macro to use HEADER_TEXT instead of POST_HEADER_TEXT.  That already is passed through to the webwork client formats.  That works without server code modification.

Making this work for Gateway quizzes will take more work than just passing the post_header_text through.  There are other problems in that case.  It might probably work if there is only one draggable proof problem per page, but would have conflicts if multiple draggable proof problems are on the same page.

Note that as of ww-2.16 (not yet released) HEADER_TEXT will also work with Gateway quizzes, although POST_HEADER_TEXT still won't (unless that changes in the next few weeks).

In reply to Glenn Rice

Re: Draggable proof macro

by Ping-Shun Chan -

Thank you very much for the update on the current status of this issue, and for the patch! Yea, I figured it would probably be easier to alter the macro instead.

Out of curiosity, would it be possible to have multiple draggableproof problems on the same page of a gateway quiz in 2.16? It seems in the current design each problem is blind to other problems rendered on the same page, so the macro would need to be further altered before being used in a quiz, no?