## Forum archive 2000-2006

### Thomas Hagedorn - Importing Problem Templates to Webwork2

by Arnold Pizer -
Number of replies: 0
 Importing Problem Templates to Webwork2 topic started 8/24/2004; 9:46:41 PMlast post 8/30/2004; 8:10:09 AM
 Thomas Hagedorn - Importing Problem Templates to Webwork2  8/24/2004; 9:46:41 PM (reads: 2143, responses: 10) On the unix level, where do the problem templates live in Webwork2. I have a course, say test_course and I'm seeing the problem templates anywhere in the webwork2/courses/test_course directory. I saw another posting on this board saying that the templates are elsewhere, but I haven't found where they are. Once one knows the location, can one just copy them from the old Webwork 1 location to the new location? Thanks, Tom <| Post or View Comments |>

 Thomas Hagedorn - Re: Importing Problem Templates to Webwork2  8/24/2004; 9:47:15 PM (reads: 2402, responses: 0) That should be "I'm not seeing the problem templates ...." <| Post or View Comments |>

 Blake Thornton - Re: Importing Problem Templates to Webwork2  8/25/2004; 11:58:53 AM (reads: 2413, responses: 0) I just figured this out this morning. If you have your old directory of templates (from ww1.9), just link it to your course template directory.  ln -s /path/to/ww19_templates /path/to/course/templates/rochester It seems that this link must be named "rochester" My questions Why does the link have to be named "rochester" Why are these problems allowed to be edited. This will lead to corrupting the problem library! Why not, when the problems are selected to be used, have the problems copied to the courses directory and then they can be edited there? (I think the answer might have something to do with SQL, but these problems should be able to be edited, but not affect the problem library). How can problems be easily added to this library? <| Post or View Comments |>

 Thomas Hagedorn - Re: Importing Problem Templates to Webwork2  8/25/2004; 12:26:53 PM (reads: 2394, responses: 0) Ok, that solves one question. Thanks! I'm assuming that if you put old set Definition files in that directory, then you'll be able to view those problem sets in Webwork2. I'm going to try this now. -Tom <| Post or View Comments |>

 Thomas Hagedorn - Re: Importing Problem Templates to Webwork2  8/25/2004; 12:33:02 PM (reads: 2393, responses: 0) One more question, where do the new "Set Definition Files" live in Webwork2? I just created a new Homework set "test_set" and I'm not seeing the set definition file anywhere. thanks, Tom <| Post or View Comments |>

 John Jones - Re: Importing Problem Templates to Webwork2  8/25/2004; 12:58:07 PM (reads: 2384, responses: 0) They live inside the database. But, from the homework sets editor page, you can export a set. That creates a set definition file. If you want, you can download it from the file transfer page and e-mail it to other instructors, who can upload it to their courses and import it. This gives a way to share assignments between courses which may not even be on the same server. John <| Post or View Comments |>

 Sam Hathaway - Re: Importing Problem Templates to Webwork2  8/26/2004; 1:30:18 AM (reads: 2439, responses: 0) This is really confusing, so I'm going to try to clear things up for everyone. I'm also having a lot of trouble explaining it, so bear with me. :)  So first of all, there's a bunch of data we want to keep track of to represent problem sets and problems: Global Set Data - Information about the the problem set itself, not including the data about each problem. This consists of the open/due/answer dates and the set/hardcopy header files. Global Problem Data - Information about each problem in each set. This consists of the weight of the problem ("value"), the number of allowed attempts, and the path to the source file, relative to the course's templates directory. User-Specific Set Data - Same as "Global Set Data", above, except for a specific user. This allows you to modify the dates and header files for a particular user. User-Specific Problem Data - Same as "Global Problem Data", above, except for a particular user. This allows you to modify the problem's weight, number of allowed attempts, and (theoretically) the source file for a particular user. ALSO: this adds several pieces of data that are user-specific, like the user's score on the problem ("status"), how many attempts they've consumed, their last submitted answer, and so on. (FIXME: Make it clear that the user-specific data is PRIMARILY to denote assignment of a set to a student and record student data, and secondarily to allow overrides of the global data.) If fields in the user-specific data tables are left blank, the global values are used.  OK! In WeBWorK 1, the only data that was kept in the course database was user-specific set and problem data. "Global" values were only stored in the set definition files, and the set definition file for a set was consulted whenever it needed to create new user-specific data. (For example, when "building" an existing set for additional students.) Since there were no "global" values, it was hard to change things for all users once a problem set was in use. You would have to delete the problem set and rebuild it from the set definition file, or change the value for each user individually. (WeBWorK 1 could change a value for all users, but it would clobber any customizations that had been made to single users, i.e. changing the weight of a problem.) One of the design goals of WeBWorK 2 was to make WeBWorK less dependant on user-edited files in the filesystem, like set definition files. This meant we had to represent the global set and problem data in the course database as well as the user-specific data. This means that instead of the WeBWorK 1 procedure of chosing or editing a set definition file (which contains the global data) and then "building" the user-specific data for each student in the course, there's a new process: creating a new problem set (global data) and then assigning the set (user-specific data) to each student in the course. There are a couple of ways to create problem sets. You can create a new, empty, problem set and then add problems to it. (More on this later.) You can also create a problem set from an existing set definition file. This is now known as "importing" a problem set. WeBWorK looks for set definition files in the course's templates directory. Once a problem set is "imported", the set definition file is is never again consulted. When you assign a problem set to students, the global data (in the database) is used to create user-specific data (also in the database). Set definition files remain useful, but only as a means of sharing problem set data with others. For example, one professor could export a problem set to a set definition file and send it to another professor. The second professor would import the set definition file to create a copy of the problem in their course. So that takes care of what data is represented in course databases, and what set definition files are used for in WeBWorK 1 and 2.  Next, we need to talk about problem source files. These contain the actual PG code used to pose a question to the student and evaluate their response. Problem source files are never stored in the course database. One of the data points about a problem (see above) is the path to the source file. This path is relative to the course's templates directory. In order for WeBWorK to find a problem source file, it must be inside the templates directory or reachabe from that directory by a symlink. This is the same in WeBWorK 1 and WeBWorK 2.  Several institutions have compiled collections of problem source files that they provide to professors so they don't have to start from scratch. To help professors use these problems, they also maintain collections of set definition files which they distribute along with the source files. These define natural sets of problems. There are a couple of ways to use these collections. First, you can import set definition files from problem collections into a course. Second, you can add problems to a set using the (probably misnamed) "Library Browser" a.k.a. "Problem Set Maker". It allows you to browse the directories in the collection and add problems therein to problem set. This method does not use set definition files at all. Of course, to do either of these things, the collection must be accessible through your course's templates directory. Historically, people have copied the contents of the collection into each new course's templates directory at the beginning of the semester. Recently, people have been adding a symlink to a central collection to each new course. This cuts down on disk space requirements for each course and allows individual courses to benefit from updates to the collection. By restricting write access to the collection, one can prevent professors from modifying shared files. However, this does prevent them from being able to customize a problem without making a copy of it first. Regardless of which method you use (copy or symlink), the WeBWorK 2 Course Administration tool allows you to copy the contents to an existing course's templates directory when creating a new course. You can set up a "model course", add problem source files and set definition files to its templates directory, and then use it when creating new courses.  And now, to complicate things... The collections described above are sometimes called "Problem Libraries". However, this name has been (prematurely?) co-opted by a project to create a national repository of problems, along with searchable metadata kept in a database. Is is our hope that this project will provide an infrastructure for sharing WeBWorK problems among institutions and make it easier to find, use, and improve problems. The "Problem Set Maker" (a.k.a. "Library Browser") considers problem collections that are symlinked or included in a course's templates directory "Local Problems". However, there is a way to make them appear separately in the library browser, as subcategories of "Local Problems" and also to give them more natural names. To do this, edit $courseFiles{problibs} in global.conf (or course.conf), to map directory or symlink names that will appear in the templates directory, to names for the buttons under "Local Problems" in the library browser. There are comments in global.conf that detail the process. The library browser also has preliminary support for "real" problem libraries, which combine an SQL-based index with a directory containing problem source files. There is little documentation on this. Perhaps John Jones and Bill Zeimer can fill in the gaps. <| Post or View Comments |>  Thomas Hagedorn - Re: Importing Problem Templates to Webwork2 8/26/2004; 2:13:22 PM (reads: 2388, responses: 0) Thanks for all the answers. It's all clear now! <| Post or View Comments |>  Blake Thornton - Re: Importing Problem Templates to Webwork2 8/27/2004; 10:17:25 AM (reads: 2373, responses: 0) Yes, this is very useful. Thanks for all the details! <| Post or View Comments |>  Michael Gage - Re: Importing Problem Templates to Webwork2 8/30/2004; 8:10:09 AM (reads: 2345, responses: 0) I just figured this out this morning. If you have your old directory of templates (from ww1.9), just link it to your course template directory. ln -s /path/to/ww19_templates /path/to/course/templates/rochester It seems that this link must be named "rochester" My questions Why does the link have to be named "rochester" The link can have any name, however --. Normally the link will appear under the center pop up list of "local problems". If the link name matches one of the names defined in $courseFiles{problibs} then the link will appear as a separate pop up list (e.g Rochester) and will be removed from the "local problems" pop up list. Edit global.conf to change this variable.  Why are these problems allowed to be edited. This will lead to corrupting the problem library! Why not, when the problems are selected to be used, have the problems copied to the courses directory and then they can be edited there? (I think the answer might have something to do with SQL, but these problems should be able to be edited, but not affect the problem library). Change the permissions on the "library" problems directory and .pg problems so that the webserver can read those problems, but can not write them. (You can check out the resulting behavior at http://hosted.webwork.rochester.edu/webwork2/maa101 -- use practice1 as login and as password. Practice1 has instructor privileges. ) If you want to create a local copy of a library problem, use the "save as" feature from the editor. A copy of the original problem will be made in the templates directory of your current course and you will be able to edit it. There is also button that allows you to add this problem to an existing set, once you have saved a local copy. <| Post or View Comments |>