Difference between revisions of "Moodle Assignment"
m (added "administrator" and "authentication" tags) |
|||
Line 468: | Line 468: | ||
In Moodle, activities are always assigned to all participants in a course. However, you still have to assign WeBWorK homework sets to students using the WeBWorK instructor tools -- this is not done automatically. |
In Moodle, activities are always assigned to all participants in a course. However, you still have to assign WeBWorK homework sets to students using the WeBWorK instructor tools -- this is not done automatically. |
||
− | |||
+ | [[Category:Administrators]] |
||
+ | [[Category:Authentication]] |
||
[[Category:Moodle_Integration]] |
[[Category:Moodle_Integration]] |
Revision as of 15:33, 15 June 2021
Contents
WWassignment
wwassignment
is a Moodle module which defines a new activity that links to a WeBWorK problem set in any WeBWorK installation 2.4 or later. The assignment allows single sign-on (moodle users who select the WeBWorK assignment are automatically logged into WeBWorK) and the grades from the homework assignment are automatically transferred back to the Moodle gradebook.
There is more than one "bridge" between Moodle and WeBWorK. For an overview see Moodle_Integration
History
The current version of this plugin, wwassignment5 will work with moodle2.x. For Moodle1.9.x, use the wwassignment4 module below.
wwassignment4 will work with moodle1.9.x (wwassignment3 which will work with moodle 1.8.x is available but no longer supported.)
The current version wwassignment5 can be downloaded using the command
svn co http://svn.webwork.maa.org/system/trunk/wwmoodle/wwassignment5/.
wwassignment5 is a client/server webservice application. Moodle acts as the client and any webwork installation 2.4 or later can be configured to act as a server. Moodle and WeBWorK do not have to be on the same server or in the same domain.
wwassignment 5 (for use with Moodle 2.x)
Requirements
- WeBWorK 2.4.5 or later
- Moodle 2.x
- MySQL 5.x or later (it might also work with MySQL 4.x but it has not been tested.)
This version of the assignment level bridge between moodle and webwork works for Moodle 2.+ (not 2.4) and WeBWorK 2.4.+ or WeBWorK 2.5+.
The update that allows these modules to work with Moodle 2.0 were done by Jonathan Duncan, Professor of Mathematics at Walla Walla University. http://math.wallawalla.edu/~duncjo/
Download and Install ( wwassignment5)
If you are updating to wwassignment5 from an earlier version of wwassignment it is safest to delete the wwassignment module using moodle's admin functions. You will need admin privileges in moodle. On the admin page to the menu: modules->activities->'manage activities' and delete the wwassignment module. Then remove the wwlink directory: moodle/blocks/wwlink and the wwassigment directory: moodle/mod/wwassignment. They will be replaced by the new directories obtained via svn.
Check out the wwassignment5 module from the WeBWorKSVN repository into your private directory.
svn co http://svn.webwork.maa.org/system/trunk/wwmoodle/wwassignment5
To install
- move the wwlink directory, currently in the blocks subdirectory,into the moodle/blocks directory
- move the wwassignment directory, currently in the mod subdirectory, into the moodle/mod directory. There is no need to run a script -- simply placing these objects into the correct moodle directories will be enough.
- After that a moodle administrator will need to login from the web in order to activate the new module and set up the preferences so that it points to a local webwork server. (Click on the "notifications" link if moodle does not immediately bring you to a configuration page).
- The configuration of the WeBWorK server is identical to the configuration of wwassignment4 as described below. If you have been using earlier versions of wwassignment, no changes will need to be made to the webwork server configuration.
wwassignment 4 (for use with Moodle 1.9.5+)
Requirements
- WeBWorK 2.4.5 or later
- Moodle 1.9.x
- MySQL 5.x or later (it might also work with MySQL 4.x but it has not been tested.)
Download and Install ( wwassignment4)
If you are updating to wwassignment4 from an earlier version of wwassignment it is safest to delete the wwassignment module using moodle's admin functions. You will need admin privileges in moodle. On the admin page to the menu: modules->activities->'manage activities' and delete the wwassignment module.
Check out the wwmoodle module from the WeBWorKSVN repository:
svn co http://svn.webwork.maa.org/system/trunk/wwmoodle/wwassignment4
This will create a wwassignment4
directory in the current directory containing subdirectories .
To update this directory from the repository simply type
svn update
in the wwassignment4
directory
Next, run the commands
cd wwassignment4/bin/setup perl setup.pl
and follow instructions to create the directory wwassignment
in moodle's
mod directory
.
You will need to know the path to the wwmoodle
directory and the path to the base of the moodle
directory.
I usually copy files rather than link to them when asked to choose although that is not essential.
The following directories are installed in your moodle software collection
blocks/wwlink -- provides the "block" that allows you to choose which WW course is connected to the moodle course mod/wwassignment -- the main body of code for implementing the wwassignment module
Configuration
Applies to wwassignment5 and wwassignment4
(1) Open Moodle and select "Notification" (you will need administrative privileges on Moodle to do this). After the Moodle database updates have completed, return to the main page and select Modules->Activities->WeBWorK Problem Set to configure the Moodle side of the Moodle-WeBWorK interface:
wwassignment_webworkurl: url of webwork course: http://host.name.edu/webwork2
wwassignment_iframewidth: 95%
wwassignment_iframeheight: 500px
wwassignment_rpc_wsdl: url of wsdl file http://host.name.edu/webwork2_wsdl
wwassignment_rpc_key:
YourSecretCodeHere
This must match the code defined in the WeBWorK installation (see below).
(2)In the WeBWorK installation (with url:
http://host.name.edu/webwork2
)
you must make these modifications.
(2a) In the file
webwork2/conf/webwork.apache-config
uncomment the lines for the SOAP installation in the final stanzas
(or add them if they are missing all together).
$ENV{WEBWORK_ROOT} = $webwork_dir;
$PerlConfig .= <<EOF;
########## SOAP installation ##########
#
# uncomment these three stanzas to use WeBWorK with Moodle
# 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>
# end of WeBWorK -- Moodle stanzas
EOF
</Perl>
For installation on systems running Apache2 the webwork.apache-config file
needs to be configured somewhat differently.
Here are excerpts
...
# Customize the variable $webwork_dir below to match the location of your
# WeBWorK installation.
#
# ATTENTION APACHE 2.2 USERS: There is a bug in mod_perl 2.0.2 that prevents the
# FollowSymlinksOption from working when specified
# in a <Perl> section. See below for workaround.
# Uncomment the ScriptAliasMatch to allow access to show-source.cgi
# This allows the "show source" button to work for demonstration "courses"
# See for example Davide Cervone's Knoxville lectures on math objects
ScriptAliasMatch /webwork2_course_files/([^/]*)/show-source.cgi/(.*) /opt/webwork/courses/$1/html/show-source.cgi/$2
PerlModule mod_perl2
<Perl>
# Set this variable to the path to your WeBWorK installation.
....
....
....
</Perl>
# APACHE 2.2 USERS: uncomment the following lines and customize the paths.
# The path for this block should be $webwork_htdocs_dir.
<Directory /opt/webwork/webwork2/htdocs>
Options FollowSymLinks
</Directory>
# The path for this block should be $webwork_courses_dir, followed by "/*/html".
<Directory /opt/webwork/courses/*/html>
Options FollowSymLinks
</Directory>
<Directory /Users/gage/webwork/courses/*/html>
Options FollowSymLinks
</Directory>
PerlModule WebworkSOAP
#WEBWORK SOAP CONFIGURATION
<Location /webwork2_rpc>
PerlHandler Apache2::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>
notice that because of the bug that existed (exists?) in
mod_perl2 we are specifying the stanzas directly rather than
using the Perl evaluation. Since there are few variables
that need customizing in this section this is not much of
an imposition.
(2b) Finally you must modify one line at the top of the file:
webwork2/lib/WebworkSOAP/WSDL.pm
to include the full domain name of the host of the WeBWorK installation.
use constant RPC_URL => 'http://host.name.edu/webwork2_rpc';
(note the agreement with the stanzas in the webwork.apache-config
file.
(2c) and modify one line at the top of the file:
webwork2/lib/WebworkSOAP.pm
to contain your secret code:
WebworkSOAP.pm:$WebworkSOAP::SeedCE{soap_authen_key} = "YourSecretCodeHere";
(3) Reboot the webwork server.
(4) Some checks:
- Try the url
http ://host.name.edu/webwork2_wsdl
This is a simple check and it should return a (complicated) wsdl file.
http ://host.name.edu/webwork2_rpc
returns a blank page but does not create an error on my machine.
YMMV. There are reports that in some cases this test returns an error because of a missing perl file even though the webwork2_rpc connection is ok.
- The other problems that I had were with broken Perl modules. I don't remember all the details, but I think that if the webwork2_rpc test fails (even though things are actually working) this triggers an attempt to produce an error report that breaks one of the perl modules (SOAP?) because of an undefined constant.
- On our installations Fedora and CentOS, we needed to install the Perl modules Pod::WSDL (via CPAN) and Apache2::SOAP (using yum to install package perl-Apache2-SOAP) for this test to work. Also on Fedora, we had to disable the Apache2 mod_security module, in order to fix the "Communication error between the Moodle client and WeBWorK server" problem.
- If moodle is returning the error "Communication error between the Moodle client and WeBWorK server." double check that the
address in the WSDL.pm file is correct (and remember to reboot the server). Check the apache error log for more detailed error messages.
Adding a WeBWorK Problem Set to a course
- Choose a Moodle course and select "turn editing on".
- Add a block called WeBWorK Link. Only users with Moodle administration privileges will be able to create and edit WWLink blocks. This prevents instructors from connecting their moodle course to a randomly selected webwork course. (see Moodle instructions for creating blocks if needed)
- The block will read "Not Connected to WeBWorK". Edit the block and from the drop-down menu select the WeBWorK course that you wish to be associated with this Moodle course. This WeBWorK course and its homework assignments should already have been set up on the WeBWorK server site. The assignments should be "visible" and be "open" i.e. available to students, otherwise the results may be unpredictable. Save changes.
- Now from "add an activity" select "WeBWorK Problem Set". You will need to fill in the moodle name for the activity and select a corresponding webwork problem set from the drop-down menu. (The menu lists all homework sets currently created in the WeBWorK course.) The other information is related to the moodle activity. (The ID number, available in Moodle 1.9 is for convenience in using the gradebook.)
- You can continue adding new WeBWorK Problem Set activities to the course in the appropriate weeks. You can also edit previous WeBWorK Problem Set activities and reassign them to a different problem set, although this might cause grading anomalies if some students have already started the assignment.
- Notice that unlike earlier versions of wwassignment nothing special needs to be done to the WeBWorK course. Any WeBWorK courses on the server can be linked to from Moodle.
Limitations
- Grades are updated from the WeBWorK database to the moodle gradebook using a "cron job" timer. This means that the gradebook is updated every hour or so as long as your Moodle installation is running a cron job. (Moodle will inform the systems administator if the cron jobs are not running.)
Also if you "edit" or "update" a moodle wwassignment this will force all of the WeBWorK data for that assignment to be updated in the Moodle gradebook. You don't actually have to change anything on the "update" page -- the grades will be added once you click the "save" or "save and return" button on the update page.
- WARNING: Changing the WW Link association of the Moodle course and a corresponding WeBWorK course may have unpredictable results. (If the assignments in the new course correspond it might work. )
- WARNING: The connection between WeBWorK is not (yet) very robust. If you delete a homework set in WeBWorK it has no-way of informing the Moodle activities linked to it and strange behavior may result. You will manually have to delete the moodle assignment. Changing the problems in the homework set will not affect the link -- but may produce unusual results in grading if some students have already done the homework set. (This also applies to using WeBWorK on its own.)
- Modifications of the due date for the homework set are communicated to some parts of Moodle (e.g. the listing of all WeBWorK Problem Sets) but not immediately to all -- for example the calendar page is not updated until the next time moodle's cron job runs.
- Modifications of the due date for individuals are not transmitted to Moodle at all -- the dates on the calendar and in the list of WeBWorK Set Problems will be incorrect for this student -- but the homework sets will work as intended once the student visits the WeBWorK course.
- New students in a Moodle course automatically have WeBWorK homework sets created for them the first time they click on that Moodle WeBWorK Problem Set assignment. They can revisit the WeBWorK Problem Set to complete questions anytime before the due date for the homework set. However when students drop the course or are deleted, their corresponding assignments are not automatically deleted from WeBWorK.
- Unenrolling a student from Moodle will not "drop" the student from the corresponding WeBWorK course. (It's possible the new event mechanism in Moodle will allow this feature to be implemented.) One can drop the student in WeBWorK using the WeBWorK tools.
- WARNING: Any instructor in a Moodle course with the "secret code" of the WeBWorK server can link to any WeBWorK course on the server, thereby installing themselves as an instructor in that WeBWorK course. UPDATE(9/20/2009) Thanks to Zig Fiedorowicz a patch has been added to block_wwlink which checks that the user has site administrator privileges before they are are allowed to edit the wwlink block. A non-administrator who turns editing on will see the message: "Sorry, but you do not currently have permissions to do that...". An administrator acting as a teacher will not however see the warning message -- only real teachers and course creators will see it.
- Using "gateway quizzes" with Moodle is problematic. In contrast to the homework mode nothing has been specifically developed to integrate gateway quizzes with Moodle. If I set up a WeBWork assignment as a proctored quiz, the wwassignment link doesn't seem to like it. It's not a huge problem, because students can navigate to the quiz directly and or use the link that comes up with the error to take the quiz.
- See also Instructor_tips_for_Moodle-WW_Assignment_module for further advice on working around WWassignments quirks.
Credits
Zbigniew Fiedorowicz and Steve Zeidner of Ohio State University first developed an implementation of a bridge between WeBWorK 1.9 (which used old CGI technology) and Moodle in spring of 2003. The bridge was implemented by using a man-in-the-middle server script to interpolate between Moodle and WeBWorK. This bridge was used extensively in most first year calculus courses at Ohio State during the period 2003-2009, serving almost 20000 students total. (It is being replaced by wwassignment4 as of Autumn, 2009.)
In late 2005 the wwmoodle
package was publicly released by Peter Snoblin at the Truman State University in Missouri to work with WeBWorK2 by sharing information within the mySQL database.
The WeBWorK parts were integrated into the official source for WeBWorK2 by Sam Hathaway. The Moodle parts (wwmoodle
and wwmoodleset
) were refactored into the original wwassignment
module by Michael Gage who also kept wwassignment current with changes in the Moodle and WeBWorK database structures.
wwassignment3
was written by Matt Leventy in 2007 and modified by Michael Gage to create wwassignment4
. This included creating the WebworkSOAP.pm SOAP interface now used to by WeBWorK to respond to Moodle's requests. In this current (wwassignment4
implementation between WeBWorK rel-2-4-7 and Moodle 1.9.5+ WeBWorK does not initiate any communication.
The update that allows these modules to work with Moodle 2.0
were done by Jonathan Duncan, Professor of Mathematics at Walla Walla University.
http://math.wallawalla.edu/~duncjo/
Historical
Requirements (wwassignment and wwassignment2)
These are no longer maintained and are not recommended unless you absolutely
must use an early version of moodle.
WeBWorK 2.3.x. or later.
Moodle 1.5.x, 1.6.x, or 1.7.x. We tested with version 2005060231 a.k.a. 1.5.3+, and later with some varieties of 1.7.
MySQL 4.1 or later.
The PHP::Serialization
Perl module. Available from CPAN.
WeBWorK and Moodle must use the same MySQL server. The account that Moodle uses to log into its database must have SELECT
access on the WeBWorK database and the account the WeBWorK uses to log into its database must have SELECT
access on the Moodle database.
Moodle must also be able to read the WeBWorK courses
directory. This can be a local directory, or it could be some kind of network mount, i.e. NFS. Moodle does not need to write to this directory.
Moodle and WeBWorK need have the same hostname. This is because the client's browser will only send the Moodle cookie to WeBWorK if the hostname matches. (The two applications can be set up on different ports though, so if you absolutely need them on different servers you could set up some kind of router-based port-forwarding. This is also useful if you need to run Moodle on Apache1 and WeBWorK on Apache2.)
(We plan to eliminate the same-server requirements in a future version.)
Installation
First, make sure that Moodle is set up to store session data in the database. Log in to Moodle as an administrator and select the "Configuration" option. Scroll down to the "Operating System" section and set the "dbsession" option to "Yes".
Check out the wwmoodle module from the WeBWorKCVS repository:
cvs -d :pserver:anoncvs@cvs.webwork.rochester.edu:/webwork/cvs/system co -D 2006-07-01 wwmoodle
(Only the versions of wwassignment written by Gage prior to July 1 of 2006 correspond to the description here. Later versions written by Leventi and wwassignment2 progress toward the creation of wwassignment3. )
This will create a wwmoodle
directory in the current directory. Move the wwassignment
subdirectory to your Moodle mod
directory.
cd wwmoodle
mv wwassignment /path/to/moodle/mod
cd /path/to/moodle
Create symlinks to the language files in the proper locations.
cd /path/to/moodle/lang/en
ln -s ../../mod/wwassignment/lang.php wwassignment.php
cd help
ln -s ../../../mod/wwassignment/help wwassignment
If you're using the utf8
encoding, move the files into the en_utf8
directory instead of the en
directory. (Or do both.)
The advantage of symlinking is that a cvs up
from the wwassignment
directory will be able to update the language files. Some people have reported problems when symlinking. If this is your experience, just move the files instead:
cd /path/to/moodle/lang/en
mv ../../mod/wwassignment/lang.php wwassignment.php
cd help
mv ../../../mod/wwassignment/help wwassignment
Log in to Moodle as an administrator and select the "Admin..." option. At this point, Moodle will set up the wwassignment
module.
Then, select the "Configuration" option and then the "Modules" option. Click the "Settings" link next to "WeBWorK Problem Set" to configure the module.
Option
Description
wwassignment_webworkcourses
This is the path to the WeBWorK courses directory. It should be set to the same value as the $webwork_courses_dir
variable in global.conf
, except that in this case it needs to end with a slash.
wwassignment_webworkurl
The URL where WeBWorK is accessible. By default, this is /webwork2
. If WeBWorK is on a different port, you'll need the full URL. This should be the same value as $webwork_url
in global.conf
. It does not need a trailing slash.
wwassignment_iframewidth
Width of frame in which WeBWorK problem sets are embedded.
wwassignment_iframeheight
Height of frame in which WeBWorK problem sets are embedded.
There are a few settings that need to be made in global.conf
as well:
Option
Description
$moodle_dsn
The DSN for the moodle database. Default: "dbi:mysql:moodle". Corresponds to dbtype
, dbhost
, and dbname
in Moodle's config.php
.
$moodle_table_prefix
The prefix to prepend to Moodle table names. Default: "mdl". Corresponds to prefix
in Moodle's config.php
.
$moodle_username
The username to use when connecting to the Moodle database. Default: same as WeBWorK database username. Corresponds to dbuser
in Moodle's config.php
.
$moodle_password
The password to use when connecting to the Moodle database. Default: same as WeBWorK database password. Corresponds to dbpass
in Moodle's config.php
.
Usage
Once you've set this up, you should notice a new WeBWorK Problem Set activity in the list of activities you can add to your course. The form for creating WeBWorK problem sets includes two interesting links.
The first is Create the WeBWorK course. This links you to the WeBWorK Course Administration page, with the name of the course pre-filled and the sql_moodle
database layout preselected. This link shows up whether or not the course has already been created, so you may get an error is the course already exists.
The second is Administer the WeBWorK portion of this course. This links you to the WeBWorK Instructor Tools page, where you can configure problem sets. You can also view, but not edit, the User List.
WeBWorK theme for Moodle
The moodle
WeBWorK theme is a modified version of the default math
theme. It detects when WeBWorK is called from within a Moodle frame, and removes superfluous interface elements. It also expands the Moodle frame so that it doesn't have to scroll.
Set the theme by changing the value of $defaultTheme
in global.conf
(for all courses) or a specific course's course.conf
(for just that course). This value can also be set for a particular course using the Course Configuration page.
Moodle authentication rules
Moodle administrators are allowed to log into any WeBWorK sql_moodle course. They are assigned permission level 10
.
Moodle teachers are allowed to log into only their corresponding WeBWorK sql_moodle course. They also get permission level 10
.
Moodle students are allowed to log into only their corresponding WeBWorK sql_moodle course. They get permission level =0=.
Moodle groups are mapped to WeBWorK recitations, unless the group begins with SEC_
, in which case, it is mapped to a WeBWorK section (with the SEC_
prefix is removed).
sql_moodle admin course
The WeBWorK course administration system can be configured to authenticate against a Moodle course.
First, create a Moodle course with the short name admin
. This course doesn't need to have any participants or any content.
If you haven't created your WeBWorK admin course yet, select the sql_moodle
database layout when you do.
If you've already created your WeBWorK admin course, edit its course.conf
file to change the $dbLayoutName
to sql_moodle
.
You will be able to log into the admin course using the credentials of any Moodle administrator. If you would like to grant access to non-administrators, make them teachers in the Moodle admin
course.
Historical Limitations
These former limitations are no longer a problem.
Course naming
(this is no longer valid)
The name of the WeBWorK course that is associated with a given Moodle course is fixed. The system takes the short name of the Moodle course and removes any non-alphanumeric characters. This value is then stored. If you have two Moodle courses with identical short names (modulo non-alphanumeric characters), they will be associated with the same WeBWorK course. The behavior in this case is not defined.
We intend to make the name of the linked WeBWorK course configurable, and prevent two Moodle courses from being associated with the same WeBWorK course.
Set assignment
(This is no longer valid)
In Moodle, activities are always assigned to all participants in a course. However, you still have to assign WeBWorK homework sets to students using the WeBWorK instructor tools -- this is not done automatically.