projects
/
pazpar2-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Handling empty nodes in the termlists.
[pazpar2-moved-to-github.git]
/
js
/
pz2.js
diff --git
a/js/pz2.js
b/js/pz2.js
index
b4344c0
..
5c32a7b
100644
(file)
--- a/
js/pz2.js
+++ b/
js/pz2.js
@@
-1,5
+1,5
@@
/*
/*
-** $Id: pz2.js,v 1.20 2007-05-21 10:10:41 jakub Exp $
+** $Id: pz2.js,v 1.30 2007-06-04 12:24:59 jakub Exp $
** pz2.js - pazpar2's javascript client library.
*/
** pz2.js - pazpar2's javascript client library.
*/
@@
-352,6
+352,7
@@
pz2.prototype = {
if ( recordNode = data.getElementsByTagName("record")[0] ) {
// if stylesheet was fetched do not parse the response
if ( __myself.xslDoc ) {
if ( recordNode = data.getElementsByTagName("record")[0] ) {
// if stylesheet was fetched do not parse the response
if ( __myself.xslDoc ) {
+ record['recid'] = recordNode.getElementsByTagName("recid")[0].firstChild.nodeValue;
record['xmlDoc'] = data;
record['xslDoc'] = __myself.xslDoc;
} else {
record['xmlDoc'] = data;
record['xslDoc'] = __myself.xslDoc;
} else {
@@
-416,8
+417,8
@@
pz2.prototype = {
//for each term in the list
for (j = 0; j < terms.length; j++) {
var term = {
//for each term in the list
for (j = 0; j < terms.length; j++) {
var term = {
- "name": terms[j].getElementsByTagName("name")[0].childNodes[0].nodeValue,
- "freq": terms[j].getElementsByTagName("frequency")[0].childNodes[0].nodeValue
+ "name": terms[j].getElementsByTagName("name")[0].childNodes[0].nodeValue || 'ERROR',
+ "freq": terms[j].getElementsByTagName("frequency")[0].childNodes[0].nodeValue || 'ERROR'
};
var termIdNode = terms[j].getElementsByTagName("id");
};
var termIdNode = terms[j].getElementsByTagName("id");
@@
-533,7
+534,7
@@
pzHttpRequest.prototype =
var paramArr = new Array();
for ( var key in params ) {
var paramArr = new Array();
for ( var key in params ) {
- paramArr.push(key + '=' + escape(params[key]));
+ paramArr.push(key + '=' + encodeURI(params[key]) );
}
if ( paramArr.length )
}
if ( paramArr.length )
@@
-541,6
+542,8
@@
pzHttpRequest.prototype =
var context = this;
this.request.open( 'GET', getUrl, true );
var context = this;
this.request.open( 'GET', getUrl, true );
+ this.request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
+ //this.request.setRequestHeader('Accept-Charset', 'UTF-8');
this.request.onreadystatechange = function () {
context._handleResponse();
}
this.request.onreadystatechange = function () {
context._handleResponse();
}
@@
-651,7
+654,7
@@
pzQuery.prototype = {
{
var ccl = '';
if( this.simpleQuery != '')
{
var ccl = '';
if( this.simpleQuery != '')
- ccl = '"'+this.simpleQuery+'"';
+ ccl = this.simpleQuery;
for(var i = 0; i < this.advTerms.length; i++)
{
if (ccl != '') ccl = ccl + ' and ';
for(var i = 0; i < this.advTerms.length; i++)
{
if (ccl != '') ccl = ccl + ' and ';