NAME

PGalias - Create aliases for auxiliary resources.

new

Usage: PGalias->new($envir, %options)

The PGalias constructor. The $envir hash containing the problem environment is required. The %options can contain WARNING_messages and DEBUG_messages which should be array references. These are passed on to all PGresource objects constructed for each problem resource and are used by both modules to store warning and debug messages.

One PGalias object is created for each PGcore object (which is unique for each problem). This object is used to construct unique ids for problem resources and maintain a list of the resources used by a problem. A unique_id_stub is generated for this PGalias object which is the basis for the unique ids generated for resource files (except equation images for the "images" display mode) used by the problem.

get_resource

Usage: $pgAlias->get_resource($aux_file_id)

Returns the PGresource object corresponding to $aux_file_id.

make_alias

Usage: $pgAlias->make_alias($aux_file_id)

This is the workhorse of the PGalias module. Its front end is alias in PG.pl.

make_alias takes the name of an auxiliary resource (html file, png file, etc.) and creates a file name or URL appropriate to the current display mode. It also does any necessary conversions behind the scenes.

It returns the URL of the resource if the display mode is HTML or PTX, and the full file path if the display mode is TeX.

alias_for_html

Usage: $pgAlias->alias_for_html($aux_file_id, $ext)

Returns the URL alias for the resource identified by $aux_file_id with the file name extension $ext.

alias_for_tex

Usage: $pgAlias->alias_for_tex($aux_file_id, $ext)

Returns the full file path alias for the resource identified by $aux_file_id with the file name extension $ext.

Usage: $pgAlias->create_link_to_tmp_file($resource_object, $subdir)

Creates a symbolic link in the subdirectory $subdir of the publicly accessible temporary directory to the file (usually in a course's templates directory) represented by the PGresource referenced by $resource_object. The link name is the file unique id alias.

convert_file_to_png_for_tex

Usage: $pgAlias->convert_file_to_png_for_tex($resource_object, $target_directory)

Converts a "gif" or "svg" file to a "png" file. The "png" file is saved in $target_directory and the file name is the unique id alias for the PGresource referenced by $resource_object.

find_file_in_directories

Usage: $pgAlias->find_file_in_directories($file_name, $directories)

Finds the first directory in the array of directory names referenced to by $directories that contains a readable file named $file_name, and returns the full path of that file.