X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=www%2Fjsdemo%2Fexample_client.js;h=0df0002577defdfe08b92017633b6ad84daf1658;hb=7182ce9776fbcadef10afe7df72e22997f68be1c;hp=9d3984b167a7db4680f6bf6b0eaf5bb8c2b72c5d;hpb=47fcaa2307337683215b398e3eaad2e06c5fe9db;p=pazpar2-moved-to-github.git diff --git a/www/jsdemo/example_client.js b/www/jsdemo/example_client.js index 9d3984b..0df0002 100644 --- a/www/jsdemo/example_client.js +++ b/www/jsdemo/example_client.js @@ -1,5 +1,5 @@ /* A very simple client that shows a basic usage of the pz2.js -** $Id: example_client.js,v 1.3 2007-07-16 09:39:56 adam Exp $ +** $Id: example_client.js,v 1.5 2007-07-24 08:15:12 jakub Exp $ */ // create a parameters array and pass it to the pz2's constructor @@ -19,7 +19,7 @@ my_paz = new pz2( { "onshow": my_onshow, var curPage = 1; var recPerPage = 20; var totalRec = 0; -var curDetRecId = -1; +var curDetRecId = ''; var curDetRecData = null; // wait until the DOM is ready @@ -34,7 +34,7 @@ function domReady () function onFormSubmitEventHandler() { curPage = 1; - curDetRecId = -1; + curDetRecId = ''; totalRec = 0; my_paz.search(document.search.query.value, recPerPage, 'relevance'); return false; @@ -94,16 +94,16 @@ function my_onterm(data) { termlist.innerHTML = "
TERMLISTS:
"; termlist.innerHTML += '
.::Subjects
'; for (var i = 0; i < data.subject.length; i++ ) { - termlist.innerHTML += '' + termlist.innerHTML += '' + data.subject[i].name - + ' (' + + ' (' + data.subject[i].freq + ')
'; } termlist.innerHTML += "
"; termlist.innerHTML += '
.::Authors
'; for (var i = 0; i < data.author.length; i++ ) { - termlist.innerHTML += '' + termlist.innerHTML += '' + data.author[i].name + ' (' + data.author[i].freq @@ -142,7 +142,7 @@ function my_onbytarget(data) { // detailed record drawing function showDetails ( prefixRecId ) { - var recId = Number(prefixRecId.replace('rec_', '')); + var recId = prefixRecId.replace('rec_', ''); // remove current detailed view if any var detRecordDiv = document.getElementById('det_'+curDetRecId); @@ -152,7 +152,7 @@ function showDetails ( prefixRecId ) { // if the same clicked do not redraw if ( recId == curDetRecId ) { - curDetRecId = -1; + curDetRecId = ''; return; } @@ -170,12 +170,18 @@ function drawCurDetails () '">
Ttle: '+data["md-title"] + "
Date: " + data["md-date"] + "
Author: " + data["md-author"] + - '
URL: ' + data["md-url"] + '' + + '
URL: ' + data["md-electronic-url"] + '' + "
Subject: " + data["md-subject"] + "
Location: " + data["location"][0].name + "
"; } +// limit the query after clicking the facet +function limitQuery (field, value) +{ + document.search.query.value += ' and ' + field + '="' + value + '"'; + onFormSubmitEventHandler(); +} // simple paging functions