lonpublisher - LON-CAPA publishing handler
lonpublisher is used by mod_perl inside Apache. This is the invocation by loncapa_apache.conf:
<Location /adm/publish> PerlAccessHandler Apache::lonacc SetHandler perl-script PerlHandler Apache::lonpublisher ErrorDocument 403 /adm/login ErrorDocument 404 /adm/notfound.html ErrorDocument 406 /adm/unauthorized.html ErrorDocument 500 /adm/errorhandler </Location>
Authors can only write-access the /~authorname/
space. They can
copy resources into the resource area through the publication step,
and move them back through a recover step. Authors do not have direct
write-access to their resource space.
During the publication step, several events will be
triggered. Metadata is gathered, where a wizard manages default
entries on a hierarchical per-directory base: The wizard imports the
metadata (including access privileges and royalty information) from
the most recent published resource in the current directory, and if
that is not available, from the next directory above, etc. The Network
keeps all previous versions of a resource and makes them available by
an explicit version number, which is inserted between the file name
and extension, for example foo.2.html
, while the most recent
version does not carry a version number (foo.html
). Servers
subscribing to a changed resource are notified that a new version is
available.
lonpublisher takes the proper steps to add resources to the LON-CAPA digital library. This includes updating the metadata table in the LON-CAPA database.
lonpublisher is many things to many people.
This module publishes a file. This involves gathering metadata, versioning the file, copying file from construction space to publication space, and copying metadata from construction space to publication space.
Many of the undocumented subroutines implement various magical parsing shortcuts.
Evaluates a string that contains metadata. This subroutine stores values inside %metadatafields and %metadatakeys. The hash key is a $unikey corresponding to a unique id that is descriptive of the parser location inside the XML tree.
Parameters:
A string that contains metadata.
Returns:
nothing
Read a metadata file
Parameters:
File output stream to output errors and warnings to.
File name (including path).
Returns:
XHTML text that indicates successful reading of the metadata.
For input parameters, these subroutines take in values such as $name, $value and other form field metadata. The output (scalar string that is returned) is an XHTML string which presents the form field (foreseeably inside <form></form> tags).
Fix up a url? First step of publication
Currently undocumented.
Currently undocumented
Currently undocumented
Currently undocumented
Currently undocumented
Currently undocumented
Store the metadata in the metadata table in the loncapa database. Uses lonmysql to access the database.
Inputs: \%metadata
Returns: (error,status). error is undef on success, status is undef on error.
This is the workhorse function of this module. This subroutine generates backup copies, performs any automatic processing (prior to publication, especially for rat and ssi files),
Returns a 2 element array, the first is the string to be shown to the user, the second is an error code, either 1 (an error occurred) or 0 (no error occurred)
Additional documentation needed.
Render second interface showing status of publication steps. This is publication step two.
Parameters:
Returns:
0: fail 1: success
A basic outline of the handler subroutine follows.
Get query string for limited number of parameters.
Check filename.
File is there and owned, init lookup tables.
Start page output.
Evaluate individual file, and then output information.
Publishing from $thisfn to $thistarget with $thisembstyle.