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>


OVERVIEW

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.


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 occurred) 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:

integer

0: fail 1: success

handler

A basic outline of the handler subroutine follows.