<para>
Pazpar2 offers programmer a simple Web Service protocol that can be
used (queried in a request/response fashion) from any, server- or
<para>
Pazpar2 offers programmer a simple Web Service protocol that can be
used (queried in a request/response fashion) from any, server- or
finished. Blocking and waiting for usually slow back-end targets is
one of the biggest functionality issues in a federated search engine.
</para>
finished. Blocking and waiting for usually slow back-end targets is
one of the biggest functionality issues in a federated search engine.
</para>
- Pazpar2 comes with a small JavaScript library called pz2.js. This
- library is designed to simplify development of an Ajax-based pazpar2
+ Pazpar2 comes with a small JavaScript library called
+ <filename>pz2.js</filename>.
+ This library is designed to simplify development of an Ajax-based pazpar2
client and alleviate programmer from the low-level details like
polling the web service, fetching and parsing returned XML output or
managing timers, sessions and basic state variables.
</para>
client and alleviate programmer from the low-level details like
polling the web service, fetching and parsing returned XML output or
managing timers, sessions and basic state variables.
</para>
<para>
The library supports most major browsers including Firefox 1.5+, IE
6+, Safari 2+, Opera 9+ and Konqueror.
</para>
<para>
The library supports most major browsers including Firefox 1.5+, IE
6+, Safari 2+, Opera 9+ and Konqueror.
</para>
<para>
In the session-aware mode, the library assumes that the pazpar2
daemon is contacted directly (preferably via Apache proxy to avoid
security breaches) and tracks the session Ids internally.
</para>
<para>
In the session-aware mode, the library assumes that the pazpar2
daemon is contacted directly (preferably via Apache proxy to avoid
security breaches) and tracks the session Ids internally.
</para>
<para>
In the session-less mode the library assumes that the client is
identified on the server and the session Ids are not managed
<para>
In the session-less mode the library assumes that the client is
identified on the server and the session Ids are not managed
style should be familiar to most JavaScript developers. A simple
client (jsdemo) is distributed with pazpar2's source code and shows
style should be familiar to most JavaScript developers. A simple
client (jsdemo) is distributed with pazpar2's source code and shows
<para>
In short, programmer starts by instantiating the pz2 object and
passing an array of parameters to the constructor. The parameter array
specifies callbacks used for handling responses to the pazpar2
commands. Additionally, the parameter array is used to configure
<para>
In short, programmer starts by instantiating the pz2 object and
passing an array of parameters to the constructor. The parameter array
specifies callbacks used for handling responses to the pazpar2
commands. Additionally, the parameter array is used to configure
- run-time parameters of the pz2.js like polling timer time-outs,
- session-mode and XSLT style-sheets.
+ run-time parameters of the <filename>pz2.js</filename> like polling
+ timer time-outs, session-mode and XSLT style-sheets.
<para>
Callback naming is simple and follows “on” prefix plus command name
scheme (like onsearch, onshow, onrecord, ... etc.). When programmer
<para>
Callback naming is simple and follows “on” prefix plus command name
scheme (like onsearch, onshow, onrecord, ... etc.). When programmer
keep on polling pazpar2 (until the backend targets are idle) and with
each command's response an assigned callback will be called. In case
of pazpar2's internal error an error callback is called.
</para>
keep on polling pazpar2 (until the backend targets are idle) and with
each command's response an assigned callback will be called. In case
of pazpar2's internal error an error callback is called.
</para>
// assigning command handler, turns on automatic polling
"onshow": my_onshow,
// polling period for each command can be specified
// assigning command handler, turns on automatic polling
"onshow": my_onshow,
// polling period for each command can be specified
- // facet terms are specified as a comma separated list
- "termlist": "subject,author",
-
+ // facet terms are specified as a comma separated list
+ "termlist": "subject,author",
+
<para>
Each command callback is a user defined function that takes a hash
object as a parameter. The hash object contains parsed pazpar2
<para>
Each command callback is a user defined function that takes a hash
object as a parameter. The hash object contains parsed pazpar2
response XML document). Within the handler programmer further
processes the data and updates the viewed document.
</para>
response XML document). Within the handler programmer further
processes the data and updates the viewed document.
</para>
- function my_onstat(data) {
- var stat = document.getElementById("stat");
- stat.innerHTML = '<span>Active clients: '+ data.activeclients
- + '/' + data.clients + ' | </span>'
- + '<span>Retrieved records: ' + data.records
- + '/' + data.hits + '</span>';
+ function my_onstat(data) {
+ var stat = document.getElementById("stat");
+ stat.innerHTML = '<span>Active clients: '+ data.activeclients
+ + '/' + data.clients + ' | </span>'
+ + '<span>Retrieved records: ' + data.records
+ + '/' + data.hits + '</span>';
<para>
The search process is initiated by calling the search method on the
instantiated pz2 object. To initiate short status reports and
per-target status information methods stat and bytarget have to be
called accordingly.
</para>
<para>
The search process is initiated by calling the search method on the
instantiated pz2 object. To initiate short status reports and
per-target status information methods stat and bytarget have to be
called accordingly.
</para>
<para>
Managing the results (keeping track of the browsed results page and
sorting) is up to the client's programmer. At any point the show
<para>
Managing the results (keeping track of the browsed results page and
sorting) is up to the client's programmer. At any point the show
<para>
To retrieve a detailed record the record command is called. When
calling record command one may temporarily override its default
callback by specifying the handler parameter. This might be useful
when retrieving raw records that need to be processed differently.
</para>
<para>
To retrieve a detailed record the record command is called. When
calling record command one may temporarily override its default
callback by specifying the handler parameter. This might be useful
when retrieving raw records that need to be processed differently.
</para>
<screen>
my_paz.record (recId, 2, 'opac', { “callback”: temp_callback, “args”, caller_args});
</screen>
<screen>
my_paz.record (recId, 2, 'opac', { “callback”: temp_callback, “args”, caller_args});
</screen>
<varlistentry><term>pazpar2path</term>
<listitem><para>server path to pazpar2 (relative to the portal), when pazpar2 is installed as a package this does not have to be set </para></listitem>
</varlistentry>
<varlistentry><term>pazpar2path</term>
<listitem><para>server path to pazpar2 (relative to the portal), when pazpar2 is installed as a package this does not have to be set </para></listitem>
</varlistentry>
- <listitem><para>boolean, when set to true pz2.js will manage sessions internally otherwise it's left to the server-side script, default true</para></listitem>
+ <listitem><para>boolean, when set to true <filename>pz2.js</filename> will manage sessions internally otherwise it's left to the server-side script, default true</para></listitem>
<varlistentry><term>autoInit</term>
<listitem><para>bolean, sets auto initialization of pazpar2 session on the object instantiation, default true, valid only if usesession is set to true</para></listitem>
</varlistentry>
<varlistentry><term>autoInit</term>
<listitem><para>bolean, sets auto initialization of pazpar2 session on the object instantiation, default true, valid only if usesession is set to true</para></listitem>
</varlistentry>
<varlistentry><term>detailstylesheet</term>
<listitem><para>path to the xsl presentation stylesheet (relative to the portal) used for the detailed record display</para></listitem></varlistentry>
<varlistentry><term>detailstylesheet</term>
<listitem><para>path to the xsl presentation stylesheet (relative to the portal) used for the detailed record display</para></listitem></varlistentry>
- <listitem><para>callback function called on any, pazpar2 or pz2.js' internal, error</para></listitem></varlistentry>
+ <listitem><para>callback function called on any, pazpar2 or <filename>pz2.js</filename>' internal, error</para></listitem></varlistentry>
<varlistentry><term>oninit</term>
<listitem><para>specifies init response callback function</para></listitem></varlistentry>
<varlistentry><term>oninit</term>
<listitem><para>specifies init response callback function</para></listitem></varlistentry>
<varlistentry><term>stop ()</term>
<listitem><para>stop activity by clearing timeouts</para></listitem></varlistentry>
<varlistentry><term>stop ()</term>
<listitem><para>stop activity by clearing timeouts</para></listitem></varlistentry>
<listitem><para>a cross-browser Ajax wrapper class</para></listitem></varlistentry>
<varlistentry><term>constructor (url, errorHandler)</term>
<listitem><para>a cross-browser Ajax wrapper class</para></listitem></varlistentry>
<varlistentry><term>constructor (url, errorHandler)</term>
<varlistentry><term>document.newXmlDoc (root)</term>
<listitem><para>create new XML document with root node as specified in parameter</para></listitem></varlistentry>
<varlistentry><term>document.newXmlDoc (root)</term>
<listitem><para>create new XML document with root node as specified in parameter</para></listitem></varlistentry>