NAME

WeBWorK::ContentGenerator::Instructor::PGProblemEditor - Edit a pg file

This editor will edit problem files, set header files, hardcopy theme files, or files such as course_info whose name is defined in the defaults.config file.

Only files under the template directory (or linked to this location) can be edited.

Editable hardcopy themes are in the directory defined by $ce->{courseDirs}{hardcopyThemes}

The course information and problems are located in the course templates directory. Course information has the name defined by $ce->{courseFiles}{course_info}

editMode = temporaryFile | savedFile

This flag is read by Problem.pm and ProblemSet.pm (perhaps others).

The value of temporaryFile means view the temp file defined by fname.user_name.tmp instead of the file fname.

The value of savedFile means to use fname directly.

The suffix for a temporary file is "user_name.tmp" by default.

File types (file_type) which can be edited.

problem

This is the most common type. This editor can be called by an instructor when viewing any problem. The information for retrieving the source file is found using the problemID in order to look look up the source file path.

source_path_for_problem_file

This is the same as the 'problem' file type except that the source for the problem is found in the parameter $r->param('sourceFilePath'). This path is relative to the templates directory

set_header

This is a special case of editing the problem. The set header is often listed as problem 0 in the set's list of problems.

hardcopy_header

This is a special case of editing the problem. The hardcopy_header is often listed as problem 0 in the set's list of problems. But it is used instead of set_header when producing a hardcopy of the problem set in the TeX format, instead of producing HTML formatted version for use on the computer screen.

hardcopy_theme

This allows editing of a hardcopy theme file, which defines snippets of tex code to be inserted before and after problems in a hardcopy. It can be called from this module when using the Hardcopy tab.

course_info

This allows editing of the course_info.txt file which gives general information about the course. It is called from the ProblemSets.pm module.

blank_problem

This is a special case which allows one to create and edit a new PG problem. The "stationary" source for this problem is stored in the assets/pg directory and defined in defaults.config as $webworkFiles{screenSnippets}{blankProblem}

Action

The behavior on submit is defined by the value of $file_type and the value of the submit button pressed (the action).

Requested actions and aliases
    View/Reload                action = view
    Generate Hardcopy:         action = hardcopy
    Tidy Code:                 action = pgtidy
    Save:                      action = save
    Save as:                   action = save_as
    Append:                    action = add_problem
    Revert:                    action = revert

An undefined or invalid action is interpreted as an initial edit of the file.

Notes

The editFilePath and tempFilePath should always be set. The tempFilePath may not exist. The path to the actual file being edited is stored in inputFilePath.