#
# Definitions for 'BrokerQuery.pl' output.  
#
# A hash (#) in the first column denotes a comment and is not processed
# even inside a definition.  Hashes not in the first column are left as-is.
#
# Variable substitution occurs on these definitions.  If you want 
# a dollar-sign ($) to occur in the output, escape it with backslash (\).
# Other metacharacters (quotes, asterisks, etc) probably don't need to be
# escaped. Printf-like special characters are allowed: \n \t \r etc..
#
# The ending newline is chopped off from each definiton.  So 
#
#   <FooBar>
#   abcxyz
#   </FooBar>
#
# becomes "abcxyz".  You may have blank lines in between the beginning 
# and ending tags, or use the newline character \n.
#
# BrokerQuery.cf,v 1.21 1995/06/23 22:48:58 wessels Exp
#

# 'GLOBAL' VARIABLES: are defined globally within the BrokerQuery.pl program,
#                     but not necessarily set at all times.
#
# $query	the user query string
# $html_query	the user query string, special HTML characters escaped
# $bquery	the query string sent to the broker
# $host		the broker hostname
# $port		the broker port
# $hp_url	the URL of the broker query (home) page
# $maxresult	the maximum number of matched lines the broker will return
# $nobjects	a running count of the number of objects returned
# $nopaquelines a running count of the number of opaque (matched) lines
#
# definitions here can be output in other definitions.  Each definition
# here is placed into the %CFG associative array.  For example,
# to print out the Timeout defined below, write $CFG{'Timeout'}
#

# The URL to the Harvest Project home page
#
<HarvestUrl>
http://harvest.cs.colorado.edu/
</HarvestUrl>


# The amount of time to wait for the broker results.
# Can use aritmetic # here also, eg: 5*60
#
# We use a conservative 10 minutes here
#
<Timeout>
600
</Timeout>

# The MIME content type of the query results.  Should be "text/html"
# if we are going to return HTML tags.
#
<ContentType>
text/html
</ContentType>

# Error Message returned if there is no query string sent
#
<NoQuery>
No query information to decode.\n
</NoQuery>

# Message sent if the user incorrectly selects 'no known replicas'
# Obsoleted by new Query.cgi stuff
#
<NoReplica>
</pre><P>
Sorry, there are no known replicas for this broker.
Please, change the <STRONG>Broker Host</STRONG> value on the query page.
</NoReplica>

# Message returned if the broker host and/or port are invalid
# Likely to be a problem with the HTML form parameters
#
<Misconfig>
</pre><P>
Sorry, but you submitted an incomplete or misconfigured query to this Broker.
If you're using Lynx, please note that Lynx 2.3 has a bug in its FORMS support
that may have caused this error; you may want to try another WWW browser.<P>
</Misconfig>

# ??? Not used by 'BrokerQuery.pl', hard-coded into BrokerQuery.pl instead
#
<BrokerDown>
</pre><P>
Sorry, the Broker at <STRONG>$host, port $port</STRONG> is unavailable.
Please try again later.<P>
</BrokerDown>

# Message returned if the broker sends back a
#      111 - Broker is too heavily loaded
# reply.
#
<BrokerLoad>
</pre><P>
Sorry, the Broker at <STRONG>$host, port $port</STRONG> is currently too
heavily loaded to process your request.  
Please try again later.<P>
</BrokerLoad>

# Message returned if the broker sends back a
#      111 - PARSE ERROR
# reply.
#
<ParseError>
</pre><P>Sorry, your query does not have the proper syntax:
<PRE>    $html_query</PRE>
<P>Please refer to the 
<A HREF="/Harvest/brokers/queryhelp.html">help in formulating queries</A>
for details on the proper syntax.<P>

Common syntax mistakes include:
<UL>

<LI>
<STRONG>Listing two words without an AND or OR joining them</STRONG>.<BR>
For example,
<CODE>resource discovery</CODE>
should be 
<CODE>resource AND discovery</CODE>

<P><LI>
<STRONG>Missing punctuation</STRONG>.<BR>
Structured queries need a colon and optional parentheses.  For example,
<CODE>Type:PostScript</CODE> or, <CODE>(Type : PostScript)</CODE>

<P><LI> 
<STRONG>Not using quotes around phrases or regular expressions</STRONG>.<BR>
For example, the <em>phrase</em>:
<CODE>resource discovery</CODE> should be 
<CODE>"resource discovery"</CODE>.
The <em>regular expression</em>:
<CODE>res.* disc.*</CODE> should be 
<CODE>"res.* disc.*"</CODE>.
Note that a <em>single dot</em> (``<CODE>.</CODE>'') 
in a keyword needs quotes (e.g. <CODE>"3.0"</CODE>).

</UL>
</ParseError>

##############################################################################
# RESULT SECTION
#
# The output of 'BrokerQuery' consists of the following tags:
#
#    ResultHeader
#    ResultSetBegin
#    ( Errors from 'broker' )
#    foreach object {
#        PrintObject
#    }
#    ResultSetEnd
#    EndBrokerResults
#    ( TruncateWarning )
#    ResultTrailer
#
#    
##############################################################################

# First output for the HTML containing the results.  Should probably include
# <TITLE> tag and the user query
#
<ResultHeader>
<HEAD>
<TITLE>Broker Query Results for: $html_query</TITLE>
</HEAD>
<H1>Broker Query Results for:</H1>
<PRE>
    $html_query</PRE>
<HR>

</ResultHeader>

# Final HTML section for the output.  Should probably contain a pointer
# to the broker home-page ($hp_url) and a pointer to the Harvest 
# home page.
#
<ResultTrailer>
<?$hp_url>
<P>Return to the <a HREF="$hp_url">Broker Home Page</a>.<BR>
</?$hp_url>
<HR>
<ADDRESS>This Broker was built using the
<A HREF="$CFG{'HarvestUrl'}">Harvest</A> system.
</ADDRESS>

</ResultTrailer>

# Output just before beginning the loop over objects returned by the 
# broker.  
#
<ResultSetBegin>
<PRE>\n
</ResultSetBegin>

# output just after ending the loop over objects returned by the broker
#
<ResultSetEnd>
</PRE>\n
</ResultSetEnd>

# EndBrokerResults is printed when the broker results end normally.
#
<EndBrokerResults>
<STRONG>$msg</STRONG><BR>\n
</EndBrokerResults>

# FailBrokerResults is printed when the broker results end in error
#
<FailBrokerResults>
<STRONG>$msg</STRONG><BR>\n
</FailBrokerResults>


# PER-OBJECT DEFINITIONS
#
# NOTES: In order for us to just use "$opaque" and have it print all the
#        matched lines properly, we must be in <PRE> mode.
#
#        Rather than just putting $cs_url in a HREF, we break it up and
#        stick the components around the 'DisplayObject' CGI program
#        which formats the SOIF into nice-looking HTML.
#
# VARIABLES: 
#
#    $url	Object url: http://www.cia.gov:3333/Spies/KGB/secret.html
#    $A		URL Access: http
#    $H		URL Host  : www.cia.gov:3333
#    $P		URL Path  : /Spies/KGB/secret.html
#    $D		URL Dir   : /Spies/KGB/
#    $F		URL File  : secret.html
#    $cs_url	URL to the SOIF object in the broker databse
#    $cs_[ahp]	elements of $cs_url as above with $url
#    $desc	Description attribute of the matched object
#    $opaque	A matched line (or all matched lines in obj-at-a-time mode)
#    $usermsg	A user message
#    $attributes Requested attributes

# This definition is much like the 'standard' output produced by the
# 'BrokerQuery.c' program.
#
<PrintObject>
$objectnum <EM>$A URL:</EM> <A HREF="$url">$F</A>
<?$H>
    <EM>host</EM>: $H
</?$H>
<?$P>
    <EM>path</EM>: $P
</?$P>
$description\
$attributes\
<?$cs_urlX>
    <A HREF="$cs_a://$cs_h/Harvest/cgi-bin/DisplayObject.cgi?object=$cs_p">indexing data</A>
</?$cs_urlX>
$opaque

</PrintObject>

# An alternate way of displaying an object
#
#<PrintObject>
#Object #: $objectnum
#filename: <A HREF="$url">$F</A>
#    Host: $H
#    Path: $D
#Indexing: <A HREF="$cs_a://$cs_h/Harvest/cgi-bin/DisplayObject.cgi?object=$cs_p">here</A>
#<STRONG>Description: $desc</STRONG>
#$opaque
#
#</PrintObject>


# ======================================================================
# The message printed to the browser and logged to the HTTP server log
# when the processes is killed.  If the Timeout time is reached, the 
# process dies from SIGALRM.  The short name of the offending signal
# is placed in $sig.
#
<sigdie>
Killed by SIG$sig...\n
</sigdie>

# How to format the object number.  Use a printf format specification
# to left/right justify, or whatever.  Do not include quotes around
# the format string.
<ObjectNumPrintf>
%2d.
</ObjectNumPrintf>

# A warning message printed only when the broker might have truncated
# the result set.  Only printed if the number of matched lines equals
# the 'maxresultflag' value of the query.html form.
#
<TruncateWarning>
<P><STRONG>WARNING: The result set was truncated at
$nopaquelines matched lines.</STRONG><P>\n
</TruncateWarning>

# A warning message printed only when the broker returned 0 results.
#
<EmptySetWarning>
<P>Your query either <em>did not match</em> any information in this
Broker, or you <em>may</em> have specified a query that is not supported by
this Broker's search subsystem.  Please refer to the 
<A HREF="/Harvest/brokers/queryhelp.html">help on formulating queries</A> 
for further assistance.<P>\n 
</EmptySetWarning>

# This definition is eval'd for each opaque (matched) line retruned by
# the broker.  It is intended to be used to remove SOIF attributes 
# and the 'Matched line' string from the output.  See the perl(1) manual
# page or book for information on building Perl regular expressions.
#
#  Add this to have URLs in mached lines be links
#
#    s/([a-z]*:\/\/\S*)/<A HREF="\1">\1<\/A>/;
#
# indent four spaces
<MatchedLineSub>
s/^.*/    $&/;
</MatchedLineSub>


# InitFunction can be some perl code which gets eval'd before they
# query is sent.  Use this for any special hackings
#
<InitFunction>
$cs_urlX = $RQ{'csumflag'} eq 'on' ? 'Y' : undef;
</InitFunction>

# PerObjectFunction is eval'd before every object is printed out.
#
<PerObjectFunction>
$description = '';
$description = "    <STRONG>Description: $desc</STRONG>\n" if ($desc ne '');
</PerObjectFunction>


# Format Requested Attributes.  Before this is eval'd, $att and $val
# should be set
#
<FormatAttribute>
    <STRONG>$att</STRONG>: $val\n
</FormatAttribute>

