From WeBWorK
Jump to: navigation, search


A general purpose administration script to manage WeBWorK installations with large numbers of courses. Functions are found in subroutine getAction, and are

  1. list defined courses
  2. delete and archive course(s) from list of defined courses
  3. add course(s) to system
  4. create assignments in course
  5. add proctors to courses
  6. delete global proctors from courses
  7. delete course proctors from courses
  8. update rosters from course CSV files (and copy homework and test work between courses)
  9. list archived courses

These functions are described below. There are a number of global variables in the global variables section at the top of the script that need to be reset to the local system: $htuser and $htgroup (the user and group that the webserver runs as, e.g., apache), and $wwHome (WeBWorK's home directory, e.g., /opt/webwork/webwork2). Course directories are located in the directory given by the $wwCourseDir variable. Other configuration variables are indicated below. In addition, the library paths for the WeBWorK libraries will need to be updated.

Note that to run the script, the environment variables WEBWORK_ROOT (=$wwHome) and MOD_PERL_API_VERSION (=2) must be defined. Also note that with newer WeBWorK installations it throws a lot of warnings as it loads WeBWorK modules. I don't think those are significant, but also haven't tracked them all down to figure out why they arise.

The script: wwManage. File for download: File:WwManage.txt (save without the .txt extension, which is added to allow upload in the Wiki).

Menu Actions

1. List: Lists all course directories in the WeBWorK course directory.

2. Delete and archive: Deletes and archives courses, selected from a list of courses in the system. The archive file(s) is(are) moved to a directory defined by the variable $archiveDir in the global variables section of the script, and are sorted by term: when deleting, the script prompts for a term identifier, and the archive file is then saved as the file $archiveDir/term/coursename.tar.gz.

3. Add course(s) to system: Add courses in batch or manually. In batch mode, the script expects to find CSV files giving the class rosters in the directory $dataDir in the global variables section of the script. The CSV files are expected to be named CRS_SEC.csv, where CRS and SEC are the course and section number of the course. The expected field order for these files is

course#, section#, username, lastname, firstnames, id#


course#, section#, username, lastname, firstnames, id#, password

This format is indicated in the prompt in the subroutine getAddCourses, and hardcoded in the subroutine addCourses2. Courses are named maCRS-SEC-TERM---where CRS is the course number, SEC the section number, and TERM the term (e.g., f12). The list of courses that are to be built is determined by a file, with the same format, giving the instructors for each course to be built.

Note that the e-mail address for the added users is set to be username@$mailDomain, where $mailDomain is set in the global variables.

Other features of the add course routines:

  • The script prompts to determine if a course coordinator should be added to the courses. This user who will be added to all WeBWorK courses created.
  • The user defined by the global variables $adminUser, $adminID, $adminLname and $adminFname is added to all courses as a professor.
  • In the addCourses2 subroutine, all instructors are added with a permission level 5 (TA) and coordinators with permission level 10 (professor). This is set by the definition of the $plevel variable in that subroutine.
  • The script allows course names to have a "campus" extension, e.g., ma115-001-umd-f12. If a campus extension is added, an administrator for that campus is also added to each such course added. This is determined by the variables @fileCampusExt, @courseCampusExt, and %courseCampusAdmins. Any roster CSV file with an extension in @fileCampusExt (e.g., 115_001_umd.csv has the extension _umd) will have a course name with the corresponding value from @courseCampusExt, and the corresponding campus administrator given in %courseCampusAdmins.

4. Add assignments: Adds assignments to all users in a specified list of courses. Assignments are copied from a sample course. All (set definition) files named "setName.def" are assigned to all users---except for sets with a Name in the global variable @groupSets, which are added to the course but not assigned to any users.

5. Add proctors to course: Adds users to a list of courses with the "proctor" permission level. The proctor users are given by a file with line format

name	username	password

(tab delimited), or

name	username	password	crs,sec[,sec]

in which case the proctors are only added to the course-section(s) numbered crs-sec. Proctors are used for proctored Gateway/Quiz assignment types. Note that proctors are added to the course with a section number of 999, and this is used to determine which users to delete when deleting proctors.

6. Delete global proctors: Deletes all non-course specific proctors from the selected courses.

7. Delete course proctors: Deletes all course specific proctors.

8. Update rosters: This routine goes through updating course rosters for already created courses so that they are consistent with the CSV files used in the add course routine. Thus if the CSV files have updated rosters, any student appearing in the CSV files who is not in the WeBWorK course roster will be added, and any in the WeBWorK roster who are not in the CSV files have their status reset to "drop."

9. List archived courses: List all course archives found in the $archiveDir directory.

follow us