NAME

lonpublisher - LON-CAPA publishing handler


SYNOPSIS

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>


DESCRIPTION

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.

SUBROUTINES

Many of the undocumented subroutines implement various magical parsing shortcuts.

metaeval
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:

$metastring
A string that contains metadata.

Returns:

nothing

metaread
Read a metadata file

Parameters:

$logfile
File output stream to output errors and warnings to.

$fn
File name (including path).

Returns:

Scalar string (if successful)
XHTML text that indicates successful reading of the metadata.

Form-field-generating subroutines.
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).
textfield
hiddenfield
selectbox
urlfixup
Fix up a url? First step of publication

absoluteurl
Currently undocumented.

set_allow
Currently undocumented

get_subscribed_hosts
Currently undocumented

get_max_ids_indices
Currently undocumented

get_all_text_unbalanced
Currently undocumented

fix_ids_and_indices
Currently undocumented

store_metadata
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.

publish
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 occured) or 0 (no error occurred)

Additional documentation needed.

phasetwo
Render second interface showing status of publication steps. This is publication step two.

Parameters:

$source
$target
$style
$distarget

Returns:

Scalar string
String contains status (errors and warnings) and information associated with the server's attempts at publication.

handler
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.