lonsearchcat - LONCAPA Search Interface
Search interface to LON-CAPAs digital library
This module enables searching for a distributed browseable catalog.
This is part of the LearningOnline Network with CAPA project described at http://www.lon-capa.org.
lonsearchcat presents the user with an interface to search the LON-CAPA digital library. lonsearchcat also initiates the execution of a search by sending the search parameters to LON-CAPA servers. The progress of search (on a server basis) is displayed to the user in a separate window.
Prints the form for the basic search. Sorry the name is so cryptic.
Prints the advanced search form.
Inputs: title text
Outputs: titletext with font wrapper
viewoptiontext()
Inputs: codename for view option
Outputs: displayed text
viewoptions()
Inputs: none
Outputs: text for box with view options
searchhelp()
Inputs: none
Outputs: return little blurb on how to enter searches
Inputs: filename of database
Outputs: returns undef on database errors.
This function is the reverse of &make_persistent() for form data. Retrieve persistent data from %persistent_db. Retrieved items will have their values unescaped. If a form value already exists in $env, it will not be overwritten. Form values that are array references may have values appended to them.
Inputs: filename of database, ref to array of values to recover.
Outputs: array of values. Returns undef on error.
This function is the reverse of &make_persistent(); Retrieve persistent data from %persistent_db. Retrieved items will have their values unescaped. If the item contains commas (before unescaping), the returned value will be an array pointer.
Inputs: Hash of values to save, filename of persistent database.
Store variables away to the %persistent_db. Values will be escaped. Values that are array pointers will have their elements escaped and concatenated in a comma separated string.
Inputs: filename of persistent database.
Store most form variables away to the %persistent_db. Values will be escaped. Values that are array pointers will have their elements escaped and concatenated in a comma separated string.
Parse advanced search form and return the following:
Parse the basic search form and return a scalar containing an sql query.
Modifies an input string to include related words. Words in the string are replaced with parenthesized lists of 'OR'd words. For example ``torque'' is replaced with ``(torque OR word1 OR word2 OR ...)''.
Note: Using this twice on a string is probably silly.
Constructs a custom metadata query using a rather heinous regular expression.
Builds a SQL logic query to check time/date entries. Also reports errors (check for /^Incorrect/).
Inputs: $Metadata, a hash pointer of metadata for a resource.
Returns: 1 if the resource is available to the user making the query, 0 otherwise.
Ensure we can get lonmysql to connect to the database and the table we need exists.
Inputs: $r, table id
Returns: undef on error, 1 if the table exists.
The sort feature is not implemented at this time. This form just prints a link to change the search query.
MySQL table creation requires a precise description of the data to be stored. The use of the correct types to hold data is vital to efficient storage and quick retrieval of records. The columns must be described in the following format:
Creates the table of search results by calling lonmysql. Stores the table id in $env{'form.table'}
Inputs: search area - either res or portfolio
Returns: the identifier of the table on success, undef on error.
Each of the following functions changes the values of one of the input fields used to display the search status to the user. The names should be explanatory.
Inputs: Apache request handler ($r), text to display.
Returns: Nothing.
Inputs: None
Returns: html string for a 'revise search' button.
Executes a search query by sending it the the other servers and putting the results into MySQL.
Returns html for the previous and next buttons on the search results page.
Prints the results out for selection and perusal.
Returns html needed for the various catalog modes. Gets inputs from $env{'form.catalogmode'}. Stores data in %groupsearch_db.
Parse a row returned from the database.
Takes a line from the file of results and parse it. Returns a hash with keys according to column labels
In addition, the following tags are set by calling the appropriate lonnet function: 'language', 'copyrighttag', 'mimetag'.
The 'title' field is set to ``Untitled'' if the title field is blank.
'abstract' and 'keywords' are truncated to 200 characters.
Output the proper html headers and javascript code to deal with different calling modes.
Takes most inputs directly from %env, except $mode.
The following environment variables are checked:
Checked for 'interactive' and 'import'.
Checked for existance & 'edit' mode.
Contains the name of the form that has the input fields to set
the name of the input field to put the URL into
the name of the input field to put the title into
Output is a HTML-ified string.
Input arguments are title, author, subject, url, keywords, version, notes, short abstract, mime, language, creation date, last revision date, owner, copyright, hostname, and extra custom metadata to show.
Output a complete page that indicates the user has not filled in enough information to do a search.
Inputs: $r (Apache request handle), $closebutton, $parms.
Returns: nothing
$parms is extra information to include in the 'Revise search request' link.
Output a full html page with an error message.
Inputs:
$r, the request pointer. $message, the error message for the user. $closebutton, the specialized close button needed for groupsearch.
Cleans the global %groupsearch_db by removing all fields which begin with 'pre_' or 'store'.