/*
-** $Id: pz2.js,v 1.6 2007-04-13 17:19:53 quinn Exp $
+** $Id: pz2.js,v 1.7 2007-04-15 03:24:18 quinn Exp $
** pz2.js - pazpar2's javascript client library.
*/
var hit = new Array();
for (i = 0; i < hits.length; i++) {
show.hits[i] = new Array();
+ show.hits[i]['location'] = new Array();
for ( j = 0; j < hits[i].childNodes.length; j++) {
+ var locCount = 0;
if ( hits[i].childNodes[j].nodeType == Node.ELEMENT_NODE ) {
- var nodeName = hits[i].childNodes[j].nodeName;
- var nodeText = hits[i].childNodes[j].firstChild.nodeValue;
- show.hits[i][nodeName] = nodeText;
+ if (hits[i].childNodes[j].nodeName == 'location') {
+ var locNode = hits[i].childNodes[j];
+ var id = locNode.getAttribute('id');
+ show.hits[i]['location'][id] = {
+ "id": locNode.getAttribute("id"),
+ "name": locNode.getAttribute("name")
+ };
+ }
+ else {
+ var nodeName = hits[i].childNodes[j].nodeName;
+ var nodeText = hits[i].childNodes[j].firstChild.nodeValue;
+ show.hits[i][nodeName] = nodeText;
+ }
}
}
}
/*
-** $Id: client.js,v 1.16 2007-04-14 23:59:20 quinn Exp $
+** $Id: client.js,v 1.17 2007-04-15 03:24:18 quinn Exp $
** MasterKey - pazpar2's javascript client .
*/
var termStartup = true;
var advancedOn = false;
+var showBriefLocations = true;
+
/* wait until the DOM is ready and register basic handlers */
$(document).ready( function() {
document.search.onsubmit = onFormSubmitEventHandler;
drawDetailedRec(detailBox);
}
- if( count > 1 ) {
- recBody.append('<span> ('+count+')</span>');
- }
+ if (showBriefLocations) {
+ var location = data.hits[i]['location'];
+ var l;
+ var list = '';
+ for (l in location) {
+ if (list)
+ list += ', ';
+ list += location[l].name;
+ }
+ recBody.append('<span> ('+list+')</span>');
+ }
+ else {
+ if( count > 1 ) {
+ recBody.append('<span> ('+count+')</span>');
+ }
+ }
recsBody.append('<div class="resultNum">'+(currentPage*currentResultsPerPage+i+1)+'.</a>');
recsBody.append(recBody);