WeBWorK Problems

How to Create a new Problem

How to Create a new Problem

by John Sylvester -
Number of replies: 6
I have just set up a private WebWork server to test with before trying to use Webworks in a course. I have a pretty good knowledge of Perl programming and have created over a 100 differential equations problems for a commercial online homework system (WebAssign).

I can see how to use the browser based editor to edit problems from the "Open Problem Library". I have spent hours trying to find some documentation of how to create a problem from scratch. I am not asking about programming constructs. I see lots of very clear documentation about pg files and mathobjects. I simply want to know how to open a browser window, like the one that opens when I click "Edit" on a library problem, so that I can type in a problem and preview the results as I work.

I can also log in to the server, so I would be happy to use my own editor, if someone can suggest a way to do frequent previews while coding.

Any suggestions, or even a general pointer to documentation, would be greatly appreciated.

Thanks

In reply to John Sylvester

Re: How to Create a new Problem

by Michael Gage -
Hi John,

If I've understood you correctly what you want to do is create a new problem. Suppose you have created a new homework set. And have added (1) "blank" problem to the homework set.

Edit the blank problem (the pencil icon).
Click on the tab "NewVersion"
Fill out the (relative to the TMPL directory) path to the file
Choose to replace the current (blankproblem.pg) problem
Click "Take action"

If you can either replace an existing problem in the homework set, or append a problem onto the end of the set or you can save a free standing file which you can later attach to a homework set.


If you want to use your own editor take a look at the file webwork2/clients/sendXMPRPC.pl https://github.com/openwebwork/webwork2/blob/master/clients/sendXMLRPC.pl . I use that with bbedit or vim to write collections of problems. I usually find the web interface quicker for bug fixing and minor updates.

There is pretty good POD documentation at the top of the file, but I will be happy to answer further questions in this thread.

Look in the Contrib section of the webwork library. There are a lot of differential equations problems that haven't yet been curated. Others may have specific suggestions of where to look.

-- Mike

In reply to Michael Gage

Re: How to Create a new Problem

by John Sylvester -
Mike,

Thanks a lot. I can get started in the browser now, and take some time to understand the Perl script.

John
In reply to John Sylvester

Re: How to Create a new Problem

by Alex Jordan -
I think the most common way is to make your way to that problem editor (say by finding an existing problem and clicking to edit it) and then clear the screen (or perhaps clear most but preserve structural elements). Then understanding the View, New Version, Append, and Revert tabs becomes important. You could use the New Version tab to define a file path and name for your new file. And after that, either use the View tab to compile the problem without saving, or keep using the New Version tab. Either way, clicking "Take Action" compiles the problem in a new tab.

(Append is like New Version, but adds the problem to an existing set. Revert is for when you have used View already, thereby creating a temporary file, and you want to trash that and go back to the last permanently saved version.)

If you edit from the server with your favorite text editor, you could separately view the output in a web browser as follows. The file should be in some course's templates/ folder (or have a file path within the templates/ folder). So for example:
vim /opt/webwork/courses/mycourse/templates/myproblem.pg

Then with a web browser, use an address like this:
https://webwork.mydomain.edu/webwork2/html2xml?&problemSeed=1&answersSubmitted=0&sourceFilePath=myproblem.pg&displayMode=MathJax&courseID=mycourse&userID=myuser&course_password=mypassword&outputformat=simple

In that URL, you should customize:
webwork.mydomain.edu
myproblem.pg (this could also be a file path like myproblems/myproblem.pg)
mycourse
myuser (some user account with at least login_proctor permissions)
mypassword (the password for that user)

Note that I would avoid using your actual professor level user account and password for this, since it would be too easy for that URL to accidentally be sent to a colleague or something, and you forget that it reveals your password.

In reply to Alex Jordan

Re: How to Create a new Problem

by John Sylvester -
In reply to Michael Gage

Re: How to Create a new Problem

by John Sylvester -
I wrote a short emacs lisp file that implements Alex's suggestion so that I can preview when logged on to the server. Its a little special,but will get me started. The question I have now is about file permissions. Here is dir output for a course I created through the web interface:
----------------------------------------------
/opt/webwork/courses/test307/templates/setHomework1:
total used in directory 16 available 130248028
drwxr-sr-x 2 www-data wwdata 4096 May 31 12:16 .
drwxr-sr-x 12 www-data wwdata 4096 May 31 11:52 ..
-rw-r--r-- 1 www-data wwdata 1465 May 31 11:52 blankProblem.pg
-rw-r--r-- 1 www-data wwdata 1465 May 31 12:16 MyFirstNewProblem.pg
-----------------------------------------

Is it OK for me to add myself to the wwdata group and give that group write permission on the templates directory and everything below that, making sure to preserve the sticky bit on the directories.

Having done that, can I add a new problem by just writing a .pg file to that directory? Does the database keep track of any of this?

There are no students involved; this is just intended for me to write a few problems.

Thanks again for the help.