Features & Development

Moodle Integration

Moodle Integration

by Matthew Leventi -
Number of replies: 12
Hello,

For the past 8 months I have been developing WeBWorK into Moodle. The final result is a plug-in in the form of a question type for Moodle 1.8.x. The application has been deployed at the University of Rochester.

The main site is: http://question2.webwork.rochester.edu. You can find more information about features and installation there.

Any feedback would be immensely appreciated.

Thanks,
Matthew Leventi
In reply to Matthew Leventi

Re: Moodle Integration

by Adam Weyhaupt -
Hi Matthew and others:

I'm wondering what exactly is the current state of affairs regarding Moodle and webwork. I am running both webwork and Moodle on my small local server for my own use (I use Moodle in my courses, rather lightly, and I would like to begin to experiment with WebWork in a few courses as well). Can anyone comment about whether these observations are correct? I'm trying to determine how best to go about integrating my systems.

For me, the most ideal system would be that WebWork works as it does, with all its power, as a standalone system. However, it would be nice to have users authenticate against a Moodle course that I already have them enrolled in. Also excellent would be if the grades would automatically go into the Moodle gradebook.

After researching things, it seems that:

- Webwork doesn't want to authenticate against Moodle 1.7. After creating a course and setting the drop down box to "sql_moodle" I get the error "table 'moodle.mdl_sessions' doesn't exist ... ". Looking in mysql, moodle.mdl_sessions does not exist, but mdl_sessions2 does. I gather I can't just change the name? :)

- The sample course that you have set up using the new webwork question server and question type look interesting, but I have a few concerns. First, it seems that some questions don't work, namely those that rely on external image files? Is that a significant constraint? Second, there is no preview button. In my (long ago) past experience, this button was very helpful to students to figure out what was going wrong. Also, the "email instructor" button is gone. None of this should be construed as criticizing you; I'm only observing that it "looks very different" than the WebWork interface.

- It looks like your work requires Moodle 1.8, right? That's probably OK, since I could upgrade. (I'm using 1.7).

- The information here http://webwork.maa.org/wiki/Moodle_Integration looked promising, but the sql_moodle problem crops up for me here, and when I try to create a new "Webwork problem set" activity, Moodle complains that "mod.html" is not found. Do I need the wwbridge block?

I'm not really asking for anyone to solve the myriad problems I've mentioned (although if you want to, that's fine). I'm rather wondering --- what are the current best options? Which methods should I try to understand?

Any thoughts and advice are welcome... Thanks!

Adam
In reply to Adam Weyhaupt

Re: Moodle Integration

by Michael Gage -
Hi Adam,

The page you refer to: http://webwork.maa.org/wiki/Moodle_Integration
gives a bit of the history creating single sign-on and grade book capabilities between moodle and WeBWorK (what we have started calling bridge1, while bridge2 is the more tightly integrated behavior where WeBWorK simply adds a new question type to the moodle quiz).

The first bridge was developed by Peter Snoblin at Truman University between moodle and WeBWorK1 (the CGI version of WeBWorK). It was further developed and used by Zig Fiedorowicz at Ohio State University.

Sam Hathaway and I rewrote bridge1 for WeBWorK2 and used it with moodle version 1.5 and then rewrote it again for 1.6 when the database changed. Our version was rather fragile since it depends on WeBWorK2 and moodle sharing the same database and looking at each others' tables to share data. I think we had it working with verison 1.7 as well at least for a while. This was clearly not the right way to build and maintain the bridge but it allowed us to get a prototype up and running quickly and to use it ourselves.

This last summer, as part of our NSF grant project and with additional support from the IT division of the University of Rochester we hired Matt Leventi to replace our bridge1 with a new bridge1 having the same functionality but communicating using XMLRPC (or as it turned out SOAP) and if there was time to start a bridge2 proto-type. He ended up doing both and continues to develop bridge2 in particular on his own time.

I have used the new bridge1 for a few courses -- it has a few bugs and enhancements that I'd like to incorporate in the next few weeks and while I'm at it I will try to match it against Moodle1.9.x which is the current stable version of Moodle. This will allow much better gradebook functionality because of changes made in Moodle's gradebook for 1.9, but it is not backwards compatible with webwork 1.8 and before.

Meantime Matt is updating bridge2 to run with moodle1.9.x as well. A few professors at U. of Rochester have used bridge2 in courses, but since the first version was just completed last summer it is not surprising that it needs some additional tweaks.


Unless there is a large demand for modules that run on older versions of moodle I'm inclined to put our resources into developing robust and stable bridges between moodle 1.9 and webwork2. The older versions of bridge1 have been largely experimental and rather than spend too much time patching them I'd prefer to take the lessons learned and apply them to bridging the new stable versions of moodle and webwork. If someone needs access to older versions of wwassignment email me and I will attempt to find them and share them with you and offer some help troubleshooting the tweaks needed to get them running on your machine.

For your specific questions. You were using the early wwassignment bridge1 which requires the databases to match. Quite possibly you can just change the name in database.conf to match moodle's new table structure. (I think moodle changed the table name sessions2 to facilitate upgrades somewhere around version 1.6 or 1.7) My recommendation however would be to grab the newer verison wwassignment3 from the CVS
http://cvs.webwork.rochester.edu/viewcvs.cgi/wwmoodle/
which might work with 1.7 as well as 1.8 since it does not depend on the database structure or even better work with us over the next few weeks to stabilize bridge1 so that it works robustly between 1.9 and webwork2 if you can upgrade to the current stable version of moodle: 1.9

Your comments about the limitations of the moodle quiz framework are accurate (except that you do get typeset echoing of what ia student types in once the submit button is pressed -- unless you are limiting the number of attempts this provides a workaround for
the lack of a preview button).

We're working as best we can to either fix the limitations or work around them while staying within the moodle framework. (Hacking the moodle interface would cause severe maintenance nightmares -- it's at best a last resort.) You also can't yet get nicely formatted pdf output of the complete homework set which bothers me personally. At least some of these omissions may be rectified in moodle 1.9 and perhaps more can be requested in moodle 2.0 if enough of us start using the moodle quiz module for webwork homework.

You do need a wwbridge block (now called the wwlink ) all of which is included in the wwassignment3 module in the cvs.

I hope that helps clarify the situation. I'm very glad you are interested in this moodle/WeBWorK integration (either bridge1 or bridge2 or both) -- I think it shows great promise -- and we'll be happy to work with you as best we can on getting it working at your site.

Take care,

Mike










In reply to Michael Gage

Re: Moodle Integration

by Adam Weyhaupt -
Mike -

OK, so bridge1 permits this sort of loose interaction between WebWork and Moodle that I see in some of Z. Fiedorowicz' courses, while bridge2 permits putting webwork questions inside of Moodle (as I see on Matthew's sample moodle site), so that the student user doesn't see any webwork interface at all. I think I am interested in bridge1, although I can see the merits of both. I gather that both bridges will be around for a little while, although bridge1 doesn't currently work with Moodle 1.9, right?

I've got no problems upgrading to Moodle 1.9, but I would like to try using webwork and Moodle for a summer course that begins in a few weeks. Is there a bridge1 that works with Moodle 1.7? If not, I'll upgrade to 1.9 and do what I can to help with this new bridge1 (although I don't know what I can do for you).

I've tried installing wwassignment3 (from the CVS) using the setup script (I'm talking about in Moodle 1.7 now). Does this require a SOAP server? Does that mean that I need to install the WW question server that Matthew has?

Thanks again for all your help,

Adam
In reply to Adam Weyhaupt

Re: Moodle Integration

by Michael Gage -
I can't make guarantees, but probably wwassignment3 will work with moodle 1.7. The single sign-on already works with moodle 1.9 for sure, but the gradebook transfer will require a little more work to work with 1.9. It might work as is with 1.7.

You don't require a separate SOAP server -- that is built into WeBWorK2, however you do need to make a few hardwired changes (until we create
an automatic configuration).

in lib/WebworkSOAP/WSDL.pm you need to replace the line:

use constant RPC_URL => 'http://localhost/webwork2_rpc';

with localhost replaced by the domain name of your server.

Similarly in lib/WebworkSOAP.pm change this line if needed:

$WebworkSOAP::SeedCE{soap_authen_key} = "123456789123456789";

You will also have to configure the activity WeBWorK Problem Sets in moodle: (see attachment) -- the main thing is to make sure that the authen_keys agree and that the domain name is correct.

Also make sure that "WeBWorK Link" is available in Blocks, but no configuration is necessary.

I think I have thought of all the configurations. Let me know how this works out.

Attachment screenshot_02.png
In reply to Michael Gage

Re: Moodle Integration

by Adam Weyhaupt -
Perhaps we have a different version of something (I've upgraded via CVS to the latest dev version of webwork, if all went well). My webwork/webork2/lib directory contains:

client153-167:/opt/webwork/webwork2/lib adam$ ls
Apache MySOAP.pm RQP.pm WeBWorK.pm WebworkWebservice.pm
CVS RQP WeBWorK WebworkWebservice
client153-167:/opt/webwork/webwork2/lib adam$

MySOAP contains no lines like what you reference above. Also, it seems that WebworkWebservice.pm contains some hard-coded references to what looks like your home directory, viz.

client153-167:/opt/webwork/webwork2/lib adam$ cat WebworkWebservice.pm | grep gage
#use lib '/home/gage/webwork/webwork-modperl/lib';
#use lib '/home/gage/webwork/pg/lib';
#use lib '/home/gage/webwork/xmlrpc/daemon';

Thanks for your help! How should I check which version I have, or, am I looking in the wrong place?

Adam
In reply to Adam Weyhaupt

Re: Moodle Integration

by Michael Gage -
There are several webservices implemented in WeBWorK (eventually we'll consolidate them) but the one you want is at webwork2/lib/WebworkSOAP (and also webwork2/lib/WebworkSOAP.pm)

You need to include the -d flag when updating so as to allow new directories to be created:

cvs update -d -A

will update you to HEAD

cvs update -d -r rel-2-4-dev

will update you to the latest stable release (which is pretty close to HEAD).

You can see the CVS file structure at:

http://cvs.webwork.rochester.edu/viewcvs.cgi/webwork2/lib/

--Mike

In reply to Michael Gage

Re: Moodle Integration

by Adam Weyhaupt -
Mike -

Following your advice below (oops!) I've upgraded to the head of the CVS tree. I know have the directories you mentioned, and I've made the changes you suggested. When I go into a course and put the wwlink block in the course, it says that I am not connected to Webwork.

I think that I don't have SOAP working properly. Apache (1) is running and comes up at

http://localhost

with the test page

http://localhost/webwork2

gives me webwork, and http://localhost/moodle

gives Moodle. All of these work individually. Who should be recogonizing a SOAP request (is that the right language?): Apache or WW? If I go to: http://localhost/webwork2_rpc, should I see something? (I get the Apache url not found error.) I've installed all of the modules listed here:

http://question2.webwork.rochester.edu/wiki/WeBWorK_Question_Server_Installation#Step_3:_CPAN_Prerequisites

from CPAN. Some of these took some work to compile, but I think I've got all of these working.

Are there changes to httpd.conf that need to be made so that Apache knows about SOAP?

Is there a way to test whether I've got all of these installed correctly? Any thoughts?

Also, you say that: "single sign-on already works with Moodle 1.9". Are you saying that if I upgrade to Moodle 1.9, then you know that I can use single-sign-on, if not important grades? Single sign-on is my biggest concern, because my Moodle set-up authenticates against the IMAP server on campus --- this works very well, because students certainly know and remember their email passwords (if only I could authenticate against Facebook... :) )

Thanks again for your help!

Adam
In reply to Adam Weyhaupt

Re: Moodle Integration

by Michael Gage -
I did forget something. You need to add the following stanzas in
webwork2/conf/webwork.apache-config at the end:

# If WeBWorK is on the root, exempt the static directories from being handled
# by Apache::WeBWorK.
#
if ($webwork_url eq "") {
 $Location{$webwork_courses_url} = { SetHandler => "none" };
 $Location{$webwork_htdocs_url} = { SetHandler => "none" };
}


#EXPERIMENTAL!!
# The following stanzas can be uncommented to enable various experimental
# WeBWorK web services. These are still in testing and have not been audited
# for security.



$PerlConfig .= <<EOF;



############Moodle bridge 1 installation (SOAP transport) ##############


PerlModule WebworkSOAP
#WEBWORK SOAP CONFIGURATION
<Location /webwork2_rpc>
 PerlHandler Apache::SOAP
 SetHandler perl-script
 PerlSetVar dispatch_to "WebworkSOAP"
 PerlSetVar options "compress_threshold => 10000"
 Order Allow,Deny
 Allow from All
</Location>
#WEBWORK SOAP WSDL HANDLER :: TO BE REPLACED WITH A FILE FOR PRODUCTION SERVERS
<Location /webwork2_wsdl>
 PerlSetVar dispatch_to "WebworkSOAP::WSDL"
 PerlSetVar options "compress_threshold => 10000"
 PerlHandler WebworkSOAP::WSDL
 SetHandler perl-script
 Order Allow,Deny
 Allow from All
</Location>
EOF

</Perl>


Other checks:

Have you configured the moodle / WeBWorK Problem Set module to connect to WeBWorK?

You will also have to configure the activity WeBWorK Problem Sets in moodle: (see attachment in previous post) -- the main thing is to make sure that the authen_keys agree and that the domain name is correct. From the admin page of moodle you need to select activities --> modules --> WeBWorK Problem sets

Also make sure that "WeBWorK Link" is available in Blocks, but no configuration is necessary. Here you have to select activities --> blocks and check that WeBWorK Link exists.

Don't upgrade to version 1.9 just yet -- I think we can get single sign-on at least working with version 1.7 or 1.8

The response is from WebworkSOAP.pm and WebworkSOAP::WSDL.pm
directed to those modules by apache using the configuration stanzas above.

Try the url http://localhost/webwork2_wsdl
This is a simple check and it should return a (complicated) wsdl file.

http://localhost/webwork2_rpc will return a blank page but should not
create an error.

I'll respond to the other comments once we get this working.

-- Mike


In reply to Michael Gage

Re: Moodle Integration

by Adam Weyhaupt -
Success!! Thank you for all your help!

I did have to upgrade to Moodle 1.8 (1.8.5 to be precise) because Moodle 1.7 expects mod.html to be in the mod directory, while wwassignment3 only came with mod_form.php (which Moodle started supporting with 1.8, I think). Adding the Apache code above instantly did the trick.

The integration between the two seems to be pretty smooth. I'm planning on doing some testing here in the next week or so and then trying this out on a summer course of about 30 students. I'll let you know how it goes. I've had a few problems with httpd crashing, but I'll try to sort that out (I don't know if it is webwork related).

I don't have time right now to write up detailed instructions about the installation process for me (and I didn't take very good notes). But I'll be happy to answer questions that anyone has.

Thanks again Mike. I hope we meet sometime, perhaps at Mathfest in Madison?

Adam
In reply to Adam Weyhaupt

Re: Moodle Integration

by Michael Gage -
Excellent. Does the gradebook work as well? or just the single sign on?

I'll let you know when I have wwassignment4 which will be compatible with moodle 1.9 (and hopefully higher) ready. With luck it won't take too much longer.

WeBWorK will be at Mathfest -- in fact reserve Friday evening if you can for our "symposium" (we use the last definition :-) )
Attachment screenshot_01.png
In reply to Michael Gage

Re: Moodle Integration

by Adam Weyhaupt -
Yes, the gradebook seems to work (I haven't tested it extensively). It even seems to work with the Gradebook Plus V2 patch, which makes the gradebook in Moodle a wonderful and usable thing (I couldn't handle the out of the box gradebook. Looks like Moodle 1.9 is perhaps (?) better).

I'll see you in Madison --- those are my favorite kind of symposia!

Thanks again,

Adam
In reply to Adam Weyhaupt

Re: Moodle Integration

by Michael Gage -
There is now a late alpha version

wwassignment4

of wwassignment which will work with moodle 1.9 (but probably not with moodle 1.8).

Instructions for obtaining the module and for installing both wwassignment3 (for moodle 1.8) and wwassignment4 (for moodle 1.9) are at
http://webwork.maa.org/wiki/Moodle_Assignment

in the wiki. Please report errors in the documentation (or add corrections :-) )